src/index.js
function denormalizeObject(obj, entities, schema, bag) {
  let denormalized = obj;

  const schemaDefinition = typeof schema.inferSchema === 'function'
    ? schema.inferSchema(obj)
    : (schema.schema || schema)
  ;

  Object.keys(schemaDefinition)
    // .filter(attribute => attribute.substring(0, 1) !== '_')
    .filter(attribute => typeof getIn(obj, [attribute]) !== 'undefined')
    .forEach((attribute) => {
      const item = getIn(obj, [attribute]);
      const itemSchema = getIn(schemaDefinition, [attribute]);

      denormalized = setIn(denormalized, [attribute], denormalize(item, entities, itemSchema, bag));
    });

  return denormalized;
}
function denormalizeObject(obj, entities, schema, bag) {
  let denormalized = obj;

  const schemaDefinition = typeof schema.inferSchema === 'function'
    ? schema.inferSchema(obj)
    : (schema.schema || schema)
  ;

  Object.keys(schemaDefinition)
    // .filter(attribute => attribute.substring(0, 1) !== '_')
    .filter(attribute => typeof getIn(obj, [attribute]) !== 'undefined')
    .forEach((attribute) => {
      const item = getIn(obj, [attribute]);
      const itemSchema = getIn(schemaDefinition, [attribute]);

      denormalized = setIn(denormalized, [attribute], denormalize(item, entities, itemSchema, bag));
    });

  return denormalized;
}
function denormalizeObject ( obj , entities , schema , bag ) { let denormalized = obj ; const schemaDefinition = typeof schema . inferSchema === 'function' ? schema . inferSchema ( obj ) : ( schema . schema || schema ) ; Object . keys ( schemaDefinition ) // .filter(attribute => attribute.substring(0, 1) !== '_') . filter ( attribute => typeof getIn ( obj , [ attribute ] ) !== 'undefined' ) . forEach ( ( attribute ) => { const item = getIn ( obj , [ attribute ] ) ; const itemSchema = getIn ( schemaDefinition , [ attribute ] ) ; denormalized = setIn ( denormalized , [ attribute ] , denormalize ( item , entities , itemSchema , bag ) ) ; } ) ; return denormalized ; }
Takes an object and denormalizes it.

Note: For non-immutable objects, this will mutate the object. This is
necessary for handling circular dependencies. In order to not mutate the
original object, the caller should copy the object before passing it here.

@param   {object|Immutable.Map} obj
@param   {object|Immutable.Map} entities
@param   {schema.Entity} schema
@param   {object} bag
@returns {object|Immutable.Map}
Takes an object and denormalizes it .