mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
22 lines
436 B
JavaScript
22 lines
436 B
JavaScript
'use strict';
|
|
|
|
const glob = require('glob');
|
|
|
|
module.exports = function(globPaths) {
|
|
return Promise.all(globPaths.map(g => expandGlobPath(g))).then(paths =>
|
|
paths.reduce((a, b) => a.concat(b), [])
|
|
);
|
|
};
|
|
|
|
function expandGlobPath(globPath) {
|
|
return new Promise((resolve, reject) => {
|
|
glob(globPath, (error, paths) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
resolve(paths);
|
|
}
|
|
});
|
|
});
|
|
}
|