src/utils/index.js
function buildFlatSourcesObjectFromTreeObject(treeObject) {
  const currentOutputObject = Object.assign({});
  currentOutputObject[treeObject.path] = treeObject.source;

  Object.keys(treeObject.dependencies).forEach(dependantTreeObjectFileName => {
    Object.assign(currentOutputObject, buildFlatSourcesObjectFromTreeObject(treeObject.dependencies[dependantTreeObjectFileName]));
  });

  return currentOutputObject;
}
function buildFlatSourcesObjectFromTreeObject(treeObject) {
  const currentOutputObject = Object.assign({});
  currentOutputObject[treeObject.path] = treeObject.source;

  Object.keys(treeObject.dependencies).forEach(dependantTreeObjectFileName => {
    Object.assign(currentOutputObject, buildFlatSourcesObjectFromTreeObject(treeObject.dependencies[dependantTreeObjectFileName]));
  });

  return currentOutputObject;
}
function buildFlatSourcesObjectFromTreeObject ( treeObject ) { const currentOutputObject = Object . assign ( { } ) ; currentOutputObject [ treeObject . path ] = treeObject . source ; Object . keys ( treeObject . dependencies ) . forEach ( dependantTreeObjectFileName => { Object . assign ( currentOutputObject , buildFlatSourcesObjectFromTreeObject ( treeObject . dependencies [ dependantTreeObjectFileName ] ) ) ; } ) ; return currentOutputObject ; }
return flat source object from a specific tree root
return flat source object from a specific tree root