Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
replaceOptions,
path
) {
const {
shouldSkipBinaryFiles,
encoding,
from,
onlyFindPathsWithoutReplace,
replaceFileOnlyIfMatchRegxpInFile: regexp,
to,
saveOldFile,
step,
} = replaceOptions;
const data = yield fs.readFile(path, encoding);
if (shouldSkipBinaryFiles && getEncoding(data) === 'binary') {
return;
}
if (onlyFindPathsWithoutReplace) {
ReplaceInFiles.findMatches({
data,
from,
path,
step,
});
return;
}
const isReplaceFile = _.some([
regexp === null,