Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

re-require

0.0.1 • Public • Published

re-require Build Status

find some require statements and maybe change them if you feel like it

var rerequire = require('re-require');
var fs = require('fs');
var strOldCode = fs.readFileSync('./your-killer-module.js', 'utf-8');
 
var strNewCode = rerequire(strOldCode, function(arg){
  // if there is a single string argument to the require call 
  // then it be passed to the callback as the only parameter.
  console.dir(arg);
 
  // this.value is the esprima node for a require call.
  // you can change it by overwriting or modifying this.value
  console.dir(this.value);
});

Keywords

none

install

npm i re-require

Downloadsweekly downloads

19

version

0.0.1

license

mit

last publish

collaborators

  • avatar
Report a vulnerability