renameify v0.3.0
Synopsis
renameify is a browserify transform for replacing variable, function and property names.
This library uses browserify-transform-tools, so you can also supply the configuration by adding a renameify field to your project's package.json file.
Install
Node.js
With NPM
npm install renameifyFrom source
git clone https://github.com/pluma/renameify.git
cd renameify
npm install
make testBasic usage example
Source
var someVariableName = 20;
console.log(someVariableName);Result
var newVariableName = 20;
console.log(newVariableName);Usage
var browserify = require('browserify'),
renameify = require('renameify'),
b = browserify();
b.transform(renameify.configure({
variables: {'someVariableName': 'newVariableName'}
}));
b.add('./app.js');
b.bundle().pipe(require('fs').createWriteStream('bundle.js'));Usage example with package.json
package.json
{
"name": "my-awesome-project",
"devDependencies": {
"browserify": "*",
"renameify": "*"
},
"renameify": {
"variables": {"someVariableName": "newVariableName"}
}
}Usage (API)
var browserify = require('browserify'),
renameify = require('renameify'),
b = browserify();
b.transform(renameify);
b.add('./app.js');
b.bundle().pipe(require('fs').createWriteStream('bundle.js'));Usage (Shell)
browserify -t renameify ./app.js > bundle.jsAPI
renameify.configure(rules):transform
Creates a browserify transform that will replace the given names.
rules.variables
Replaces all matching variable names. This includes local (var, let, etc) and global variables, as well as argument names in function declarations and function expressions.
rules.properties
Replaces all matching property names. This includes names used in object literals (foo in {foo: 2}, {'foo': 2} and {"foo": 2}) as well as in property references (foo in bar.foo, bar['foo'] and bar["foo"]).
rules.functions
Replaces all matching function names. This includes function declarations as well as named function expressions.
Unlicense
This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.






