babel-plugin-transform-es2015-block-scoping
Compile ES2015 block scoping (const and let) to ES5
Last updated 8 years ago by hzoo .
MIT · Repository · Original npm · Tarball · package.json
$ npm install babel-plugin-transform-es2015-block-scoping 
SYNC missed versions from official npm registry.

babel-plugin-transform-es2015-block-scoping

Compile ES2015 block scoping (const and let) to ES5

Installation

npm install --save-dev babel-plugin-transform-es2015-block-scoping

Usage

Via .babelrc (Recommended)

.babelrc

Without options:

{
  "plugins": ["transform-es2015-block-scoping"]
}

With options:

{
  "plugins": [
    ["transform-es2015-block-scoping", {
      "throwIfClosureRequired": true
    }]
  ]
}

Via CLI

babel --plugins transform-es2015-block-scoping script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-es2015-block-scoping"]
});

Options throwIfClosureRequired

In cases such as the following it's impossible to rewrite let/const without adding an additional function and closure while transforming:

for (let i = 0; i < 5; i++) {
  setTimeout(() => console.log(i), 1);
}

In extremely performance-sensitive code, this can be undesirable. If "throwIfClosureRequired": true is set, Babel throws when transforming these patterns instead of automatically adding an additional function.

Current Tags

  • 6.26.0                                ...           latest (7 years ago)
  • 7.0.0-beta.3                                ...           next (7 years ago)

51 Versions

  • 7.0.0-beta.3                                ...           7 years ago
  • 7.0.0-beta.2                                ...           7 years ago
  • 7.0.0-beta.1                                ...           7 years ago
  • 7.0.0-beta.0                                ...           7 years ago
  • 7.0.0-alpha.20                                ...           7 years ago
  • 6.26.0                                ...           7 years ago
  • 7.0.0-alpha.19                                ...           7 years ago
  • 7.0.0-alpha.18                                ...           7 years ago
  • 7.0.0-alpha.17                                ...           7 years ago
  • 7.0.0-alpha.16                                ...           7 years ago
  • 7.0.0-alpha.15                                ...           7 years ago
  • 7.0.0-alpha.14                                ...           7 years ago
  • 7.0.0-alpha.12                                ...           7 years ago
  • 7.0.0-alpha.11                                ...           7 years ago
  • 7.0.0-alpha.10                                ...           7 years ago
  • 7.0.0-alpha.9                                ...           8 years ago
  • 7.0.0-alpha.8                                ...           8 years ago
  • 6.24.1                                ...           8 years ago
  • 7.0.0-alpha.7                                ...           8 years ago
  • 7.0.0-alpha.3                                ...           8 years ago
  • 7.0.0-alpha.1                                ...           8 years ago
  • 6.23.0                                ...           8 years ago
  • 6.22.0                                ...           8 years ago
  • 6.21.0                                ...           8 years ago
  • 6.20.0                                ...           8 years ago
  • 6.18.0                                ...           8 years ago
  • 6.15.0                                ...           8 years ago
  • 6.14.0                                ...           8 years ago
  • 6.10.1                                ...           8 years ago
  • 6.10.0                                ...           8 years ago
  • 6.9.0                                ...           8 years ago
  • 6.8.0                                ...           9 years ago
  • 6.7.1                                ...           9 years ago
  • 6.7.0                                ...           9 years ago
  • 6.6.5                                ...           9 years ago
  • 6.6.4                                ...           9 years ago
  • 6.6.0                                ...           9 years ago
  • 6.5.0-1                                ...           9 years ago
  • 6.5.0                                ...           9 years ago
  • 6.4.0                                ...           9 years ago
  • 6.3.13                                ...           9 years ago
  • 6.2.4                                ...           9 years ago
  • 6.1.18                                ...           9 years ago
  • 6.1.17                                ...           9 years ago
  • 6.1.10                                ...           9 years ago
  • 6.1.5                                ...           9 years ago
  • 6.1.4                                ...           9 years ago
  • 6.0.18                                ...           9 years ago
  • 6.0.14                                ...           9 years ago
  • 6.0.9                                ...           9 years ago
  • 6.0.2                                ...           9 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE