UNPKG

782 BJavaScriptView Raw
1"use strict";
2var glob = require("glob");
3exports.documentsFromGlobs = function (documents) {
4 return Promise.all(documents.map(function (documentGlob) {
5 return new Promise(function (resolve, reject) {
6 glob(documentGlob, function (err, files) {
7 if (err) {
8 reject(err);
9 }
10 if (!files || files.length === 0) {
11 reject("Unable to locate files matching glob definition: " + documentGlob);
12 }
13 resolve(files);
14 });
15 });
16 }))
17 .then(function (files) {
18 return files.length === 0 ? [] : files.reduce(function (a, b) {
19 return a.concat(b);
20 });
21 });
22};
23//# sourceMappingURL=documents-glob.js.map
\No newline at end of file