babel-plugin-catch

1.0.5 • Public • Published

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"]
});

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-catch

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

3.96 kB

Total Files

3

Last publish

Collaborators

  • jasonlzy