mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-06-16 21:21:46 +08:00
* Bump dependencies * [feature] #38 Count number of matches * Update make-replacements.js * [feature] #42 Differentiate number of matches and number of replacements * [enhance] #56 Support for CWD parameter * Default config value * [enhance] #63 Add --quiet flag to supress console output in CLI * Update success-handler.js * Update readme and add change log
27 lines
556 B
JavaScript
27 lines
556 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Dependencies
|
|
*/
|
|
const globAsync = require('./glob-async');
|
|
|
|
/**
|
|
* Get paths asynchrously
|
|
*/
|
|
module.exports = function getPathsAsync(patterns, config) {
|
|
|
|
//Extract relevant config
|
|
const {ignore, disableGlobs, allowEmptyPaths, glob: cfg} = config;
|
|
|
|
//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));
|
|
};
|