src/utils/object.js
function deepObj(pathKeys, obj, createEntries = true) {
  return pathKeys.reduce((prev, curr) => {
    if (typeof prev[curr] === 'undefined') {
      if (createEntries) {
        prev[curr] = {};
      } else {
        DrizzleError.error(
          new DrizzleError(
            `Property ${curr} not found on supplied object`,
            DrizzleError.LEVELS.ERROR
          )
        );
      }
    }
    return prev[curr];
  }, obj);
}
function deepObj(pathKeys, obj, createEntries = true) {
  return pathKeys.reduce((prev, curr) => {
    if (typeof prev[curr] === 'undefined') {
      if (createEntries) {
        prev[curr] = {};
      } else {
        DrizzleError.error(
          new DrizzleError(
            `Property ${curr} not found on supplied object`,
            DrizzleError.LEVELS.ERROR
          )
        );
      }
    }
    return prev[curr];
  }, obj);
}
function deepObj ( pathKeys , obj , createEntries = true ) { return pathKeys . reduce ( ( prev , curr ) => { if ( typeof prev [ curr ] === 'undefined' ) { if ( createEntries ) { prev [ curr ] = { } ; } else { DrizzleError . error ( new DrizzleError ( ` ${ curr } ` , DrizzleError . LEVELS . ERROR ) ) ; } } return prev [ curr ] ; } , obj ) ; }
Return a reference to the deeply-nested object indicated by the items
in `pathKeys`. If `createEntries`, entry levels will be created as needed
if they don't yet exist on `obj`.

@param {Array} pathKeys    Elements making up the "path" to the reference
@param {Object}            Object to add needed references to

@example deepRef(['foo', 'bar', 'baz'], { foo: {} }, true); // => foo.bar.baz
Return a reference to the deeply - nested object indicated by the items in pathKeys . If createEntries entry levels will be created as needed if they don t yet exist on obj .