mapFiles() returns an object based on passed file path array
mapping file name as key and promised content as value

@param {Array} files
@return {Object} filesMap
161330
function (files) {
  return files.reduce(function (filesMap, file) {
    let fileName = path.parse(file).name;
    filesMap[fileName] = readFile(file, 'utf8');

    return filesMap;
  }, {});
}
723246
function createFileTree (filePaths)
{
  var path = require ('path')
    , root = {
    files:      [],
    subfolders: new Map
  };

  filePaths.forEach (function (filename)
  {
    var dir = path.dirname (filename)
      , folderPtr = root;
    if (dir)
      dir.split (path.sep).forEach (function (segment)
      {
        if (!folderPtr.subfolders.has (segment))
          folderPtr.subfolders.set (segment, {
            files:      [],
            subfolders: new Map
          });
        folderPtr = folderPtr.subfolders.get (segment);
      });
    folderPtr.files.push (filename);
  });
  return root;
}
803956
function getFiles(res, pattern, options) {
  var files = res.split(/\r?\n/).filter(Boolean);
  if (files.length === 1 && files[0] === pattern) {
    files = [];
  } else if (options.realpath === true || options.follow === true) {
    files = toAbsolute(files, options);
  }
  if (files.length === 0) {
    if (options.nullglob === true) {
      return [pattern];
    }
    if (options.failglob === true) {
      return new Error('no matches:' + pattern);
    }
  }

  return files.filter(function(filepath) {
    return filepath !== '.' && filepath !== '..';
  });
}
1171719
function convert(files) {
    var converted = []
    files.forEach(function(file) {
      // We need originals as the destinations may not yet exist
      file = file.orig
      var dest = file.dest

      // Use destination for source if no source is available
      if (!file.src.length) {
        converted.push({
          src: dest,
          dest: dest
        })
        return
      }

      file.src.forEach(function(source) {
        converted.push({
          src: source,
          dest: dest
        })
      })
    })
    return converted
  }
1266238
function isFileGroup(files) {
  const basePatternString = `~${files.length}/nth/`;
  const mapExpression = (val, idx) => new RegExp(`${basePatternString}${idx}/$`);
  const expressions = Array.from({ length: files.length }, mapExpression);
  return expressions.every(exp => files.some(url => exp.test(url)));
}
1280868
async function buildPathsObject(files) {
  return Promise.all(
    files.map(async filepath => {
      const name = path.basename(filepath, '.svg');
      const svg = fs.readFileSync(filepath, 'utf-8');
      const pathStrings = await svgo.optimize(svg, { path: filepath })
        .then(({ data }) => data.match(/ d="[^"]+"/g) || [])
        .then(paths => paths.map(s => s.slice(3)));
      return `"${name}": [${pathStrings.join(',\n')}]`;
    }),
  );
}
269135
function lintFiles(files) {

    const eslint = new CLIEngine()

    const report = eslint.executeOnFiles(files)

    return {
        text: friendlyFormatter(report.results),
        errorCount: report.errorCount,
    }

}
538528
function _getFiles(path){
        let files = [];
        fs.readdirSync(path).forEach(function(file){
            let subpath = path + '/' + file;
            if(fs.lstatSync(subpath).isDirectory()){
                let filesReturned = _getFiles(subpath);
                files = files.concat(filesReturned);
            } else {
                files.push(path + '/' + file);
            }
        });
        return files;
    }
1304566
async function hashes(files) {
  const map = new Map();

  await Promise.all(
    files.map(async name => {
      const data = await fs.promises.readFile(name);

      const h = hash(data);
      const entry = map.get(h);
      if (entry) {
        entry.names.push(name);
      } else {
        map.set(hash(data), { names: [name], data });
      }
    })
  );
  return map;
}
1207712
function processDir(options, callback) {
  return fs.readdir(options.path, function(err, filenames) {
    if (err) {
      return callback(err);
    }

    if (options.ignoreDotFiles) {
      filenames = _.filter(filenames, function(filename) {
        return filename[0] !== ".";
      });
    }

    return async.map(filenames, function(filename, done) {
      const abspath = path.join(options.path, filename);

      if (options.statEach === false) {
        return done(null, {
          filename,
          path: abspath,
        });
      }

      stat(abspath, function(statErr, stats) {
        if (statErr) {
          return done(statErr);
        }
        return done(null, stats);
      });
    }, function(mapErr, statsMap) {
      if (mapErr) {
        return callback(err);
      }

      if (!options.ignoreCurDir) {
        const stats = _.cloneDeep(options.dirStats);
        stats.filename = ".";
        statsMap.push(stats);
      }

      if (!options.ignoreUpDir) {
        const abspath = path.join(options.path, "..");
        return stat(abspath, function(statErr, stats) {
          if (err) {
            return callback(err);
          }
          stats.filename = "..";
          statsMap.push(stats);
          return callback(null, statsMap);
        });
      }

      return callback(null, statsMap);
    });
  });
}
134906
function (next) {
									for (var i = 0; i < mapFiles.length; i++) {
										fs.unlinkSync(mapFiles[i]);
										// console.log( path.resolve(mapFiles[i]) );
									}
									return next();
								}
561066
function getJSFiles(folder = srcFolder){
  let all = [];
  let f = fs.readdirSync(folder);
  for(file of f){
    all.push(path.join(folder,file))
    if(fs.lstatSync(path.join(folder,file)).isDirectory()){
      all = all.concat(getJSFiles(path.join(folder,file)));
    }
  }
  return all.filter(x => x.endsWith('.js'));
}
71443
@SuppressWarnings("unused")
    private Map<String, String> hashFiles(String... fileNames) {
        Map<String, String> hashes = new HashMap<String, String>();
        for (int i = 0; i < fileNames.length; i++) {
            String hash = hashURL(fileNames[i]);
            hashes.put(fileNames[i], hash);
        }
        return hashes;
    }
1730
public static function createFromFilesGlobal(array $files) : array
    {
        $items = [];
        $files = self::normalizeSuperglobal($files);
        self::buildMap($files, $items);

        return $items;
    }
1294885
public function createMap(...$paths)
    {
        $classes = [];

        $this->finder->files()
            ->ignoreUnreadableDirs()
            ->in($paths);

        foreach($this->excludePathPatterns as $exclude)
        {
            $this->finder->notPath($exclude);
        }

        foreach($this->inPathPatterns as $inPath)
        {
            $this->finder->path($inPath);
        }

        foreach($this->names as $name)
        {
            $this->finder->name($name);
        }

        /** @var SplFileInfo $file */
        foreach ($this->finder as $file) {
            $content = file_get_contents($file->getPathname());

            preg_match('^\s*class ([\S]*)\s*(extends|implements|{)^', $content, $match, PREG_OFFSET_CAPTURE);

            if (isset($match[1])) {
                $className = '\\'. trim($match[1][0]);
                $offset = $match[1][1];
            } else {
                continue;
            }

            preg_match('|\s*namespace\s*([\S]*)\s*;|', substr($content, 0 , $offset), $match);

            if (isset($match[1]) && trim($match[1]) !== '') {
                $className = '\\' . trim($match[1]) . $className;
            }

            if ($className !== '\\') {
                $classes[$file->getPathname()] = $className;
            }
        }

        return $classes;
    }
1188935
function loadFiles(directories, files)
{
  // sort extensions to provide deterministic order of loading
  var _instance  = this
    , extensions = resolveExts.call(this)
    , layers     = []
    ;

  // treat all inputs as list of directories
  directories = (typeOf(directories) == 'array') ? directories : [directories];

  files.forEach(function(filename)
  {
    var layer = {file: filename, exts: []};

    extensions.forEach(function(ext)
    {
      var layerExt = {ext: ext, dirs: []};

      directories.forEach(function(dir)
      {
        var cfg, file = path.resolve(dir, filename + '.' + ext);

        if (fs.existsSync(file))
        {
          cfg = loadContent.call(_instance, file, _instance.parsers[ext]);

          // check if any hooks needed to be applied
          cfg = applyHooks.call(_instance, cfg, filename);
        }

        if (cfg)
        {
          layerExt.dirs.push({
            dir   : dir,
            config: cfg
          });
        }
      });

      // populate with non-empty layers only
      if (layerExt.dirs.length)
      {
        layer.exts.push(layerExt);
      }
    });

    // populate with non-empty layers only
    if (layer.exts.length)
    {
      layers.push(layer);
    }

  });

  return layers;
}
300363
function loadMappings(rootDir, paths) {
        var mappings = {}, i, j, fullPath, fileNames, fileName, path, name, val;

        if (!paths) {
            return mappings;
        }

        for (i = 0; i < paths.length; i++) {
            path = paths[i];
            fullPath = rootDir + '/' + path;

            // if the directory doesn't exist, then skip to the next loop iteration
            if (!fs.existsSync(p.normalize(fullPath))) {
                continue;
            }

            // loop through all files in this folder
            fileNames = fs.readdirSync(p.normalize(fullPath));

            for (j = 0; j < fileNames.length; j++) {
                fileName = fileNames[j];

                // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping
                if (utils.isJavaScript(fileName) && !fileName.match(/^.*\.service\.js$/)) {
                    name = utils.getCamelCase(fileName);
                    val = utils.getModulePath(path, fileName);
                    mappings[name] = val;
                    mappings[name.substring(0, 1).toUpperCase() + name.substring(1)] = val;  // store PascalCase as well
                }

                // else if we are dealing with a directory, recurse down into the folder
                else if (fs.lstatSync(p.join(fullPath, fileName)).isDirectory()) {
                    _.extend(mappings, this.loadMappings(rootDir, [path + '/' + fileName]));
                }
            }
        }

        return mappings;
    }