verb
Version:
Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.
29 lines (23 loc) • 634 B
JavaScript
;
var mm = require('micromatch');
var glob = require('globby');
/**
* Loads files from the root of the current project.
* Returns matching function bound to the list of files.
*
* ```js
* console.log(verb.files('*.js'));
* //=> ['foo.js', 'bar.js']
* ```
*/
module.exports = function(verb) {
var patterns = ['*', 'lib/*', 'test/*'];
var files = glob.sync(patterns, {dot: true});
verb.files = function (pattern, options) {
return mm(files, pattern, options);
};
verb.fileExists = function (pattern, options) {
var res = verb.files(pattern, options);
return !!(res && res.length);
};
};