npm.io
1.0.1 • Published 6 years ago

babel-plugin-global-assignment

Licence
ISC
Version
1.0.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0

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
}