src/index.js
function resolveEntityOrId(entityOrId, entities, schema) {
  const key = schema.key;

  let entity = entityOrId;
  let id = entityOrId;

  if (isObject(entityOrId)) {
    const mutableEntity = isImmutable(entity) ? entity.toJS() : entity;
    id = schema.getId(mutableEntity) || getIn(entity, ['id']);
  } else {
    entity = getIn(entities, [key, id]);
  }

  return { entity, id };
}
function resolveEntityOrId(entityOrId, entities, schema) {
  const key = schema.key;

  let entity = entityOrId;
  let id = entityOrId;

  if (isObject(entityOrId)) {
    const mutableEntity = isImmutable(entity) ? entity.toJS() : entity;
    id = schema.getId(mutableEntity) || getIn(entity, ['id']);
  } else {
    entity = getIn(entities, [key, id]);
  }

  return { entity, id };
}
function resolveEntityOrId ( entityOrId , entities , schema ) { const key = schema . key ; let entity = entityOrId ; let id = entityOrId ; if ( isObject ( entityOrId ) ) { const mutableEntity = isImmutable ( entity ) ? entity . toJS ( ) : entity ; id = schema . getId ( mutableEntity ) || getIn ( entity , [ 'id' ] ) ; } else { entity = getIn ( entities , [ key , id ] ) ; } return { entity , id } ; }
Take either an entity or id and derive the other.

@param   {object|Immutable.Map|number|string} entityOrId
@param   {object|Immutable.Map} entities
@param   {schema.Entity} schema
@returns {object}
Take either an entity or id and derive the other .