JSPM

replace-requires

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28085
  • Score
    100M100P100Q143010F
  • License MIT

Replace require statements

Package Exports

  • replace-requires

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (replace-requires) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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