replace-in-file
Advanced tools
Changelog
4.0.0
The return value is now a results array instead of an array with changed files. The new results array includes each file that was processed, with a flag to indicate whether or not the file was changed, and optionally information about the number of matches and replacements that were made. See the readme for more details.
To update existing code and obtain an array of changed files again, simply convert the results array as follows:
const results = await replace(options);
const changedFiles = results
.filter(result => result.hasChanged)
.map(result => result.file);