replace-requires
v1.1.0
Published
Replace require statements
Downloads
110,958
Readme
replace-requires ![Build Status](https://travis-ci.org/bendrucker/replace-requires.svg?branch=master)
Replace require statements
Install
$ npm install --save replace-requires
Usage
var replaceRequires = require('replace-requires');
replaceRequires('require("foo")', {foo: 'bar'});
//=> bar
API
replaceRequires(code, replacements)
-> string
code
Required
Type: string
The code to parse and replace.
replacements
Required
Type: object
The replacements, where keys are module ids and the corresponding values are the replacements for their require statements.
License
MIT © Ben Drucker