1.0.1 • Published 4 years ago

babel-plugin-global-assignment v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

babel-plugin-global-assignment

A babel-plugin that translates global assignment statements into setting property statements for global objects.

Install

npm install --save-dev babel-plugin-global-assignment

Usage

Via .babelrc

{
  "plugins": [
    [
      "babel-plugin-global-assignment", {
        "globalObject": "window"
      }
    ]
  ]
}

Options

  • globalObject: Specify global object name.

Example

in

foo = true
function () {
  bar = true
  let baz = false
  baz = true
}

out

window.foo = true
function () {
  window.bar = true
  let baz = false
  baz = true
}