Skip to content

thepeoplescoder/throw_

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published