Wraps Throw Expressions in an IIFE
This plugin transforms Throw Expressions into an IIFE.
``js`
function test(param = throw new Error('required!')) {
const test = param === true || throw new Error('Falsey!');
}
`sh`
npm install --save-dev babel-plugin-transform-throw-expressions
.babelrc
`json`
{
"plugins": ["transform-throw-expressions"]
}
`sh`
babel --plugins transform-throw-expressions script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["transform-throw-expressions"]
});