src/utils/object.js
function flattenById(obj, keyedObj = {}) {
  if (obj.hasOwnProperty('id')) {
    keyedObj[obj.id] = obj;
  }
  for (var key in obj) {
    if (isObject(obj[key])) {
      flattenById(obj[key], keyedObj);
    }
  }
  return keyedObj;
}
function flattenById(obj, keyedObj = {}) {
  if (obj.hasOwnProperty('id')) {
    keyedObj[obj.id] = obj;
  }
  for (var key in obj) {
    if (isObject(obj[key])) {
      flattenById(obj[key], keyedObj);
    }
  }
  return keyedObj;
}
function flattenById ( obj , keyedObj = { } ) { if ( obj . hasOwnProperty ( 'id' ) ) { keyedObj [ obj . id ] = obj ; } for ( var key in obj ) { if ( isObject ( obj [ key ] ) ) { flattenById ( obj [ key ] , keyedObj ) ; } } return keyedObj ; }
Take a deeply-nested object and return a single-level object keyed
by the `id` property of original object entries.

@param {Obj} obj
@param {Obj} keyedObj   For recursion; not strictly necessary but...
@return {Obj} keyed by ids
Take a deeply - nested object and return a single - level object keyed by the id property of original object entries .