$ 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).
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
}
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
} finally {
doSomeCleanup();
}
npm install --save-dev babel-plugin-transform-optional-catch-binding
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-optional-catch-binding"]
}
babel --plugins transform-optional-catch-binding script.js
require("babel-core").transform("code", {
plugins: ["transform-optional-catch-binding"]
});
© 2010 - cnpmjs.org x YWFE | Home | YWFE