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