caoge c760052ff9 机车状态修改 | 8 months ago | |
---|---|---|
.. | ||
node_modules | 8 months ago | |
index.js | 8 months ago | |
license | 8 months ago | |
package.json | 8 months ago | |
readme.md | 8 months ago |
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(['index.js', 'inner_folder'], {
cwd: 'fixtures'
}).then(files => {
console.log(files);
//=> ['index.js', 'inner_folder/**']
});
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.
Type: string
Test in specific directory.
MIT © Kevin Mårtensson