NOTE: This package is no longer being maintained. If you are interested in taking over as maintainer or are interested in the npm package name, get in touch by creating an issue.
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.
npm install renameify
git clone https://github.com/pluma/renameify.git
cd renameify
npm install
make test
var someVariableName = 20;
console.log(someVariableName);
var newVariableName = 20;
console.log(newVariableName);
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'));
{
"name": "my-awesome-project",
"devDependencies": {
"browserify": "*",
"renameify": "*"
},
"renameify": {
"variables": {"someVariableName": "newVariableName"}
}
}
var browserify = require('browserify'),
renameify = require('renameify'),
b = browserify();
b.transform(renameify);
b.add('./app.js');
b.bundle().pipe(require('fs').createWriteStream('bundle.js'));
browserify -t renameify ./app.js > bundle.js
Creates a browserify transform that will replace the given names.
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.
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"]
).
Replaces all matching function names. This includes function declarations as well as named function expressions.
This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.