7.0.0-beta.3 • Published 7 years ago

babel-plugin-transform-throw-expressions v7.0.0-beta.3

Weekly downloads
213
License
MIT
Repository
github
Last release
7 years ago

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