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 renameify
From source
git clone https://github.com/pluma/renameify.gitcd renameifynpm installmake test
Basic usage example
Source
var someVariableName = 20;console;
Result
var newVariableName = 20;console;
Usage
var browserify = renameify = b = ; b;b;b;
Usage example with package.json
package.json
Usage (API)
var browserify = renameify = b = ; b;b;b;
Usage (Shell)
browserify -t renameify ./app.js > bundle.js
API
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.