doxx

collectFiles

function
collectFiles() ->Array

Option name Type Description
source String source path
options Object option object

Create an array of all the right files in the source dir

function collectFiles(source, options) {
  var dirtyFiles = walkdir.sync(source), // tee hee!
      ignore     = options.ignore || [],
      files      = [];

  dirtyFiles.forEach(function(file){
    file = path.relative(source, file);

    var doNotIgnore = _.all(ignore, function(d){
      // return true if no part of the path is in the ignore list
      return (file.indexOf(d) === -1);
    });

    if ((file.substr(-2) === 'js') && doNotIgnore) {
      files.push(file);
    }
  });

  return files;
}
jsFiddle