Compile optional catch bindings
npm install 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).
``js`
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
}
`js`
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
} finally {
doSomeCleanup();
}
`sh`
npm install --save-dev babel-plugin-transform-optional-catch-binding
.babelrc
`json`
{
"plugins": ["transform-optional-catch-binding"]
}
`sh`
babel --plugins transform-optional-catch-binding script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["transform-optional-catch-binding"]
});