$ npm install babel-plugin-syntax-optional-catch-binding
This plugin allows Babel to parse optional catch bindings.
Syntax
try {
throw 0;
} catch {
doSomethingWhichDoesntCareAboutTheValueThrown();
console.log("Yay, code executes!");
}
npm install --save-dev babel-plugin-syntax-optional-catch-binding
.babelrc
(Recommended).babelrc
{
"plugins": ["syntax-optional-catch-binding"]
}
babel --plugins syntax-optional-catch-binding script.js
require("babel-core").transform("code", {
plugins: ["syntax-optional-catch-binding"]
});
© 2010 - cnpmjs.org x YWFE | Home | YWFE