Convert directories to glob compatible strings
$ npm install dir-glob
const dirGlob = require('dir-glob');
dirGlob(['index.js', 'test.js', 'fixtures']).then(files => {
console.log(files);
//=> ['index.js', 'test.js', 'fixtures/**']
});
dirGlob(['lib/**', 'fixtures'], {
files: ['test', 'unicorn']
extensions: ['js']
}).then(files => {
console.log(files);
//=> ['lib/**', 'fixtures/**/test.js', 'fixtures/**/unicorn.js']
});
dirGlob(['lib/**', 'fixtures'], {
files: ['test', 'unicorn', '*.jsx'],
extensions: ['js', 'png']
}).then(files => {
console.log(files);
//=> ['lib/**', 'fixtures/**/test.{js,png}', 'fixtures/**/unicorn.{js,png}', 'fixtures/**/*.jsx']
});
Returns a Promise
for an array of glob strings.
Returns an array of glob strings.
Type: Array
string
A string
or an Array
of paths.
Type: Array
Append extensions to the end of your globs.
Type: Array
Only glob for certain files.
MIT © Kevin Mårtensson
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.