1.1.1 • Published 9 years ago

replaceit v1.1.1

Weekly downloads
1
License
ISC
Repository
bitbucket
Last release
9 years ago

Build Status

Info

Goes through files and replaces determined text, currently does not support symbolic links however.

How To

Install with npm

npm i replaceit

Run unit tests with npm test make sure you either do an npm i inside replaceit or install mocha and chai before hand since the tests require these modules.

To use replaceit simply require it and use it as a function

const replaceit = require('replaceit');
replaceit({
    path: 'Path/To/Your/File',
    regex: 'Regex String',
    replacement: 'Replace string or Object',
    async: true, //defaults to true
    loop: false //defaults to false, if true replaceit will loop directories if the path given is a directory
    })

replacement accepts both a string or an object of strings. For example:

{
    'valuetomatch': 'valuetoreplaceitwith'
}

This can be as long as you want, and if your regex finds a match that match will be used to find the property of the object and replace it with that value.

1.1.1

9 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago