lib/utils.js
function asDataMap(files, mapping, callback) {
  try {
    const out = files.reduce((obj, file) => {
      let key;
      switch (mapping) {
        case Mapping.DIR:
          key = path.dirname(file.path);
          break;
        case Mapping.MODULE:
          key = trimExtension(file.path).replace(PATH_SEP_RE, '.');
          break;
        default:
          key = file.path;
          break;
      }

      return Object.assign(obj, { [key]: file.data });
    }, {});
    async.nextTick(callback, null, out);
  } catch (error) {
    async.nextTick(callback, error);
  }
}
function asDataMap(files, mapping, callback) {
  try {
    const out = files.reduce((obj, file) => {
      let key;
      switch (mapping) {
        case Mapping.DIR:
          key = path.dirname(file.path);
          break;
        case Mapping.MODULE:
          key = trimExtension(file.path).replace(PATH_SEP_RE, '.');
          break;
        default:
          key = file.path;
          break;
      }

      return Object.assign(obj, { [key]: file.data });
    }, {});
    async.nextTick(callback, null, out);
  } catch (error) {
    async.nextTick(callback, error);
  }
}
function asDataMap ( files , mapping , callback ) { try { const out = files . reduce ( ( obj , file ) => { let key ; switch ( mapping ) { case Mapping . DIR : key = path . dirname ( file . path ) ; break ; case Mapping . MODULE : key = trimExtension ( file . path ) . replace ( PATH_SEP_RE , '.' ) ; break ; default : key = file . path ; break ; } return Object . assign ( obj , { [ key ] : file . data } ) ; } , { } ) ; async . nextTick ( callback , null , out ) ; } catch ( error ) { async . nextTick ( callback , error ) ; } }
Map files data with their path as key.
Map files data with their path as key .