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

Readme

Keywords

none

Package Sidebar

Install

npm i re-require

Weekly Downloads

126

Version

0.0.1

License

mit

Last publish

Collaborators

  • chevett