replace-requires

1.1.0 • Public • Published

replace-requires Build Status

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

Readme

Keywords

Package Sidebar

Install

npm i replace-requires

Weekly Downloads

27,427

Version

1.1.0

License

MIT

Unpacked Size

3.33 kB

Total Files

4

Last publish

Collaborators

  • bendrucker