0.0.1 • Published 10 years ago

re-require v0.0.1

Weekly downloads
62
License
mit
Repository
-
Last release
10 years ago

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);
});