replace-require
Replace your require statements
Last updated 6 years ago by asbjornenge .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install replace-require 
SYNC missed versions from official npm registry.

replace-require

Replace require statements.

Heavily inspired by transform-deps, but allows replacement of the whole require statement.

Install

npm install --save replace-require

Use

var rpl = require('replace-require')
var src = rpl("require('foo');require('bar')", function(target) {
    if (target.indexOf('foo') >= 0) return "require('baz')" 
})
console.log(src)
// => require('baz');require('bar')

Changelog

1.1.0

  • Updated acorn

1.0.0

  • Initial release :tada:

enjoy

Current Tags

  • 1.1.0                                ...           latest (6 years ago)

2 Versions

  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |