babel-plugin-transform-throw-expressions
Wraps Throw Expressions in an IIFE
Last updated 7 years ago by hzoo .
MIT · Repository · Original npm · Tarball · package.json
$ npm install babel-plugin-transform-throw-expressions 
SYNC missed versions from official npm registry.

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

Current Tags

  • 7.0.0-beta.3                                ...           latest (7 years ago)
  • 7.0.0-beta.3                                ...           next (7 years ago)

1 Versions

  • 7.0.0-beta.3                                ...           7 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE