babel-plugin-transform-throw-expressions

7.0.0-beta.3 • Public • Published

babel-plugin-transform-throw-expressions

This plugin transforms Throw Expressions into an IIFE.

Example

function test(param = throw new Error('required!')) {
  const test = param === true || throw new Error('Falsey!');
}

Installation

npm install --save-dev babel-plugin-transform-throw-expressions

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-throw-expressions"]
}

Via CLI

babel --plugins transform-throw-expressions script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-throw-expressions"]
});

References

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-transform-throw-expressions

Weekly Downloads

242

Version

7.0.0-beta.3

License

MIT

Last publish

Collaborators

  • hzoo