import toArray from 'lodash/toArray';
import {Map} from 'immutable';

export function getProjectKeys(state) {
  return toArray(state.projects.keys());
}

export function getCurrentProject(state) {
  const projectKey = state.currentProject.get('projectKey');
  if (projectKey) {
    return state.projects.get(projectKey).toJS();
  }
  return null;
}

export function isPristineProject(project) {
  if (Map.isMap(project)) {
    return !project.has('updatedAt');
  }
  return !('updatedAt' in project);
}

import {Map} from 'immutable';

export function getProjectKeys(state) {
  return Array.from(state.projects.keys());
}

export function getCurrentProject(state) {
  const projectKey = state.currentProject.get('projectKey');
  if (projectKey) {
    return state.projects.get(projectKey).toJS();
  }
  return null;
}

export function isPristineProject(project) {
  if (Map.isMap(project)) {
    return !project.has('updatedAt');
  }
  return !('updatedAt' in project);
}

Use Array.from instead of toArray
Use Array.from instead of toArray

`toArray` seems to return weird/wrong results in PhantomJS, although why
it just started doing that in this branch is unclear. Anyway, the
built-in `Array.from` appears to work just fine.
