1.0.5 • Published 4 years ago
babel-plugin-catch v1.0.5
babel-plugin-catch
Add trycatch to your magic comment
Installlation
npm install babel-plugin-catch or yarn add babel-plugin-catchUsage
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.jsVia Node API
require("babel-core").transform("code", {
plugins: ["babel-plugin-catch"]
});