Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.
/ renameify Public archive

UNMAINTAINED. A browserify transform for replacing variable names.

License

Notifications You must be signed in to change notification settings

pluma/renameify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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.

stability 3 - stable license - Unlicense Flattr this

Build Status Coverage Status Dependencies

NPM status

Install

Node.js

With NPM

npm install renameify

From source

git clone https://github.com/pluma/renameify.git
cd renameify
npm install
make test

Basic 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.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.

About

UNMAINTAINED. A browserify transform for replacing variable names.

Resources

License

Stars

Watchers

Forks

Packages

No packages published