babel-plugin-replace-identifiers

0.1.1 • Public • Published

babel-plugin-replace-identifiers

replace-identifiers

It replace an Identifier to another Identifier.

If you want to replace an Identifier to a string literal(LVal), you can see this: babel-plugin-inline-replace-variables

Example

.babelrc

{
  "plugins": [
    ["replace-identifiers", {
      "React": "Rx"
    }]
  ]
}

In

React.createElement('foo', bar, 'React', React);

Out

Rx.createElement('foo', bar, 'React', Rx);

Installation

$ npm install babel-plugin-replace-identifiers

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [["replace-identifiers", {
    "foo": "bar",
    "hello": "world"
  }]]
}

Via CLI

$ babel --plugins replace-identifiers script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["replace-identifiers"]
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    898
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    898
  • 0.1.0
    9

Package Sidebar

Install

npm i babel-plugin-replace-identifiers

Weekly Downloads

907

Version

0.1.1

License

none

Last publish

Collaborators

  • zeroling