mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-04-29 05:05:33 +08:00
26 lines
498 B
JavaScript
26 lines
498 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Dependencies
|
|
*/
|
|
const globAsync = require('./glob-async');
|
|
|
|
/**
|
|
* Get paths asynchrously
|
|
*/
|
|
module.exports = function getPathsAsync(
|
|
patterns, ignore, disableGlobs, allowEmptyPaths, cfg
|
|
) {
|
|
|
|
//Not using globs?
|
|
if (disableGlobs) {
|
|
return Promise.resolve(patterns);
|
|
}
|
|
|
|
//Expand globs and flatten paths
|
|
return Promise
|
|
.all(patterns
|
|
.map(pattern => globAsync(pattern, ignore, allowEmptyPaths, cfg)))
|
|
.then(paths => [].concat.apply([], paths));
|
|
};
|