@babel/plugin-proposal-optional-catch-binding
Examples
try {
throw 0;
} catch {
doSomethingWhichDoesNotCareAboutTheValueThrown();
}
try {
throw 0;
} catch {
doSomethingWhichDoesNotCareAboutTheValueThrown();
} finally {
doSomeCleanup();
}
Installation
npm install --save-dev @babel/plugin-proposal-optional-catch-binding
Usage
With a configuration file (Recommended)
{
"plugins": ["@babel/plugin-proposal-optional-catch-binding"]
}
Via CLI
babel --plugins @babel/plugin-proposal-optional-catch-binding script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-proposal-optional-catch-binding"]
});
References