aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-proposal-optional-catch-binding
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/plugin-proposal-optional-catch-binding')
-rw-r--r--node_modules/@babel/plugin-proposal-optional-catch-binding/README.md60
-rw-r--r--node_modules/@babel/plugin-proposal-optional-catch-binding/lib/index.js47
-rw-r--r--node_modules/@babel/plugin-proposal-optional-catch-binding/package.json22
3 files changed, 129 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-proposal-optional-catch-binding/README.md b/node_modules/@babel/plugin-proposal-optional-catch-binding/README.md
new file mode 100644
index 00000000..e06eb65d
--- /dev/null
+++ b/node_modules/@babel/plugin-proposal-optional-catch-binding/README.md
@@ -0,0 +1,60 @@
+# @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).
+
+
+## Examples
+
+```js
+try {
+ throw 0;
+} catch {
+ doSomethingWhichDoesntCareAboutTheValueThrown();
+}
+```
+
+```js
+try {
+ throw 0;
+} catch {
+ doSomethingWhichDoesntCareAboutTheValueThrown();
+} finally {
+ doSomeCleanup();
+}
+```
+
+
+## Installation
+
+```sh
+npm install --save-dev @babel/plugin-proposal-optional-catch-binding
+```
+
+## Usage
+
+### 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
+```
+
+### 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)
diff --git a/node_modules/@babel/plugin-proposal-optional-catch-binding/lib/index.js b/node_modules/@babel/plugin-proposal-optional-catch-binding/lib/index.js
new file mode 100644
index 00000000..e87c22c4
--- /dev/null
+++ b/node_modules/@babel/plugin-proposal-optional-catch-binding/lib/index.js
@@ -0,0 +1,47 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+function _helperPluginUtils() {
+ const data = require("@babel/helper-plugin-utils");
+
+ _helperPluginUtils = function _helperPluginUtils() {
+ return data;
+ };
+
+ return data;
+}
+
+function _pluginSyntaxOptionalCatchBinding() {
+ const data = _interopRequireDefault(require("@babel/plugin-syntax-optional-catch-binding"));
+
+ _pluginSyntaxOptionalCatchBinding = function _pluginSyntaxOptionalCatchBinding() {
+ return data;
+ };
+
+ return data;
+}
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _default = (0, _helperPluginUtils().declare)(api => {
+ api.assertVersion(7);
+ return {
+ inherits: _pluginSyntaxOptionalCatchBinding().default,
+ visitor: {
+ CatchClause(path) {
+ if (!path.node.param) {
+ const uid = path.scope.generateUidIdentifier("unused");
+ const paramPath = path.get("param");
+ paramPath.replaceWith(uid);
+ }
+ }
+
+ }
+ };
+});
+
+exports.default = _default; \ No newline at end of file
diff --git a/node_modules/@babel/plugin-proposal-optional-catch-binding/package.json b/node_modules/@babel/plugin-proposal-optional-catch-binding/package.json
new file mode 100644
index 00000000..9ea865ea
--- /dev/null
+++ b/node_modules/@babel/plugin-proposal-optional-catch-binding/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "@babel/plugin-proposal-optional-catch-binding",
+ "version": "7.0.0-beta.47",
+ "description": "Compile optional catch bindings",
+ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-catch-binding",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "keywords": [
+ "babel-plugin"
+ ],
+ "dependencies": {
+ "@babel/helper-plugin-utils": "7.0.0-beta.47",
+ "@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.47"
+ },
+ "peerDependencies": {
+ "@babel/core": "7.0.0-beta.47"
+ },
+ "devDependencies": {
+ "@babel/core": "7.0.0-beta.47",
+ "@babel/helper-plugin-test-runner": "7.0.0-beta.47"
+ }
+}