babel-plugin-transform-optional-catch-binding

Compile optional catch bindings

MIT 9 个版本
安装
npm install babel-plugin-transform-optional-catch-binding
yarn add babel-plugin-transform-optional-catch-binding
pnpm add babel-plugin-transform-optional-catch-binding
bun add babel-plugin-transform-optional-catch-binding
README

babel-plugin-transform-optional-catch-binding

Optional catch binding enables the catch block to execute whether or not an argument is passed to the catch statement (CatchClause).

Examples

try {
  throw 0;
} catch {
  doSomethingWhichDoesntCareAboutTheValueThrown();
}
try {
  throw 0;
} catch {
  doSomethingWhichDoesntCareAboutTheValueThrown();
} finally {
  doSomeCleanup();
}

Installation

npm install --save-dev babel-plugin-transform-optional-catch-binding

Usage

.babelrc

{
  "plugins": ["transform-optional-catch-binding"]
}

Via CLI

babel --plugins transform-optional-catch-binding script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-optional-catch-binding"]
});

References

版本列表
7.0.0-beta.3 2017-10-15
7.0.0-beta.2 2017-09-26
7.0.0-beta.1 2017-09-19
7.0.0-beta.0 2017-09-12
7.0.0-alpha.20 2017-08-30
7.0.0-alpha.19 2017-08-07
7.0.0-alpha.18 2017-08-03
7.0.0-alpha.17 2017-07-26
7.0.0-alpha.16 2017-07-25