@babel/plugin-proposal-optional-catch-binding
Advanced tools
Comparing version 7.0.0-beta.49 to 7.0.0-beta.50
{ | ||
"name": "@babel/plugin-proposal-optional-catch-binding", | ||
"version": "7.0.0-beta.49", | ||
"version": "7.0.0-beta.50", | ||
"description": "Compile optional catch bindings", | ||
@@ -12,4 +12,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-catch-binding", | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.0.0-beta.49", | ||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.49" | ||
"@babel/helper-plugin-utils": "7.0.0-beta.50", | ||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.50" | ||
}, | ||
@@ -20,5 +20,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.49", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.49" | ||
"@babel/core": "7.0.0-beta.50", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.50" | ||
} | ||
} |
# @babel/plugin-proposal-optional-catch-binding | ||
> Optional catch binding enables the catch block to execute whether or not an argument is passed to the catch statement (CatchClause). | ||
> Compile optional catch bindings | ||
See our website [@babel/plugin-proposal-optional-catch-binding](https://new.babeljs.io/docs/en/next/babel-plugin-proposal-optional-catch-binding.html) for more information. | ||
## Examples | ||
## Install | ||
```js | ||
try { | ||
throw 0; | ||
} catch { | ||
doSomethingWhichDoesntCareAboutTheValueThrown(); | ||
} | ||
``` | ||
Using npm: | ||
```js | ||
try { | ||
throw 0; | ||
} catch { | ||
doSomethingWhichDoesntCareAboutTheValueThrown(); | ||
} finally { | ||
doSomeCleanup(); | ||
} | ||
``` | ||
## Installation | ||
```sh | ||
npm install --save-dev @babel/plugin-proposal-optional-catch-binding | ||
npm install --save @babel/plugin-proposal-optional-catch-binding | ||
``` | ||
## Usage | ||
or using yarn: | ||
### Via `.babelrc` (Recommended) | ||
**.babelrc** | ||
```json | ||
{ | ||
"plugins": ["@babel/plugin-proposal-optional-catch-binding"] | ||
} | ||
``` | ||
### Via CLI | ||
```sh | ||
babel --plugins @babel/plugin-proposal-optional-catch-binding script.js | ||
yarn add --save @babel/plugin-proposal-optional-catch-binding | ||
``` | ||
### Via Node API | ||
```javascript | ||
require("@babel/core").transform("code", { | ||
plugins: ["@babel/plugin-proposal-optional-catch-binding"] | ||
}); | ||
``` | ||
## References | ||
- [Proposal: Optional Catch Binding for ECMAScript](https://github.com/babel/proposals/issues/7) |
2162
3
20
+ Added@babel/helper-plugin-utils@7.0.0-beta.50(transitive)
+ Added@babel/plugin-syntax-optional-catch-binding@7.0.0-beta.50(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.49(transitive)
- Removed@babel/plugin-syntax-optional-catch-binding@7.0.0-beta.49(transitive)
Updated@babel/plugin-syntax-optional-catch-binding@7.0.0-beta.50