babel-plugin-transform-optional-catch-binding

Compile optional catch bindings

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-transform-optional-catch-binding
7.0.0-alpha.166 years ago6 years agoMinified + gzip package size for babel-plugin-transform-optional-catch-binding in KB

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

Via .babelrc (Recommended)

.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