Skip to content

liuzeyang/babel-plugin-catch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Add trycatch to your magic comment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published