lib/load-enrichers.js
function loadEnrichers () {
  // find all the js files in the resource-enrichers directory
  const enrichers = fs.readdirSync(`${__dirname}/resource-enrichers`).reduce((loaded, file) => {
    const filesSplit = file.split('.');
    if (filesSplit[1] === 'js') {
      const mod = require(`./resource-enrichers/${file}`);
      loaded[mod.name] = mod.enrich;

      return loaded;
    }

    return loaded;
  }, {});

  return enrichers;
}
function loadEnrichers () {
  // find all the js files in the resource-enrichers directory
  const enrichers = fs.readdirSync(`${__dirname}/resource-enrichers`).reduce((loaded, file) => {
    const filesSplit = file.split('.');
    if (filesSplit[1] === 'js') {
      const mod = require(`./resource-enrichers/${file}`);
      loaded[mod.name] = mod.enrich;

      return loaded;
    }

    return loaded;
  }, {});

  return enrichers;
}
function loadEnrichers ( ) { // find all the js files in the resource-enrichers directory const enrichers = fs . readdirSync ( ` ${ __dirname } ` ) . reduce ( ( loaded , file ) => { const filesSplit = file . split ( '.' ) ; if ( filesSplit [ 1 ] === 'js' ) { const mod = require ( ` ${ file } ` ) ; loaded [ mod . name ] = mod . enrich ; return loaded ; } return loaded ; } , { } ) ; return enrichers ; }
Returns an object with the enrichers The key property will be the name prop from the enricher The value will be the enrich function from the enricher
Returns an object with the enrichers The key property will be the name prop from the enricher The value will be the enrich function from the enricher