12345678910111213141516171819202122232425262728293031323334 |
- 'use strict';
- const glob = require('glob');
- module.exports = function globAsync(pattern, ignore, allowEmptyPaths, cfg) {
-
- cfg = Object.assign({ignore}, cfg, {nodir: true});
-
- return new Promise((resolve, reject) => {
- glob(pattern, cfg, (error, files) => {
-
- if (error) {
- return reject(error);
- }
-
- if (!allowEmptyPaths && files.length === 0) {
- return reject(new Error('No files match the pattern: ' + pattern));
- }
-
- resolve(files);
- });
- });
- };
|