get-paths-async.js 556 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. /**
  3. * Dependencies
  4. */
  5. const globAsync = require('./glob-async');
  6. /**
  7. * Get paths asynchrously
  8. */
  9. module.exports = function getPathsAsync(patterns, config) {
  10. //Extract relevant config
  11. const {ignore, disableGlobs, allowEmptyPaths, glob: cfg} = config;
  12. //Not using globs?
  13. if (disableGlobs) {
  14. return Promise.resolve(patterns);
  15. }
  16. //Expand globs and flatten paths
  17. return Promise
  18. .all(patterns
  19. .map(pattern => globAsync(pattern, ignore, allowEmptyPaths, cfg)))
  20. .then(paths => [].concat.apply([], paths));
  21. };