babel-plugin-catch
v1.0.5
Published
Add trycatch to your magic comment
Downloads
12
Readme
babel-plugin-catch
Add trycatch to your magic comment
Installlation
npm install babel-plugin-catch or yarn add babel-plugin-catch
Usage
const test = (num/* catch */) => {
}
class Test{
test(num, num2/* catch */){
}
test = (num, num2/* catch */) => {
}
}
.babelrc
{
"plugins": [
["babel-plugin-catch", {
comment?: 'catch',
catchCode?: (e) => {
},
finallyCode?: () =>{
}
}]
]
}
Via CLI
$ babel --plugins babel-plugin-catch script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["babel-plugin-catch"]
});