1.0.0 • Published 9 years ago
replace-require-functions v1.0.0
replace-require-functions
Replace the require function for certain modules
Install
$ npm install --save replace-require-functions
Usage
var replaceRequires = require('replace-requires');
// Call it on a string of JS code
replaceRequires('require("foo")', {foo: 'bar'});
// Returns the file, but with the `require` function replaced
bar("foo")
// Call it again
replaceRequires('require("foo/fooz")', {foo: 'bar'});
// Also works on requires with paths; matches the first path segment
bar("foo/fooz")
License
MIT © Ben Drucker
1.0.0
9 years ago