1.0.0 • Published 12 months ago

@thepeoplescoder/throw_ v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

throw_

A package that provides a single function:

function throw_(thing: any): never

If thing is a function, throw thing() is executed, otherwise throw thing is executed.

That's it.

How To build

Run this in a terminal window:

npm run build

Usage

Using ES6 modules:

import { throw_ } from "@thepeoplescoder/throw_";

Using CommonJS:

const { throw_ } = require("@thepeoplescoder/throw_");

Afterwards, you can do things along the lines of this:

expression = isErrorCondition
  ? throw_(anErrorObjectOrAFunctionThatReturnsSomethingThrowable)
  : intendedValueOfExpression;
1.0.0

12 months ago