New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

babel-plugin-transform-optional-catch-binding

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-optional-catch-binding

Compile optional catch bindings

7.0.0-alpha.16
latest
Version published
Weekly downloads
1.9K
29.68%
Maintainers
1
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 25 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts