123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- const glob = require('glob');
- module.exports = function getPathsSync(patterns, config) {
-
- const {ignore, disableGlobs, glob: globConfig, cwd} = config;
-
- if (disableGlobs) {
- return patterns;
- }
-
- const cfg = Object.assign({ignore}, globConfig, {nodir: true});
-
-
- if (cwd) {
- cfg.cwd = cwd;
- }
-
- const paths = patterns.map(pattern => glob.sync(pattern, cfg));
- const flattened = [].concat.apply([], paths);
-
-
- if (cwd) {
- return flattened.map(path => `${cwd}${path}`);
- }
-
- return flattened;
- };
|