@solardancer/test

0.1.8 • Public • Published

@solardancer/test

JSR NPM CI

A simple assertion function.

Usage

import assert from '@solardancer/test';

assert(true); // doesn't throw

assert(false); // throws an AssertionError

assert(false, 'message'); // throws an AssertionError with a custom error message

assert(false, new Error('message')); // throws a custom Error

const value: string | undefined = 'hello';
assert(value !== undefined); // narrows the type of value to string;
value.toUpperCase(); // works

Readme

Keywords

none

Package Sidebar

Install

npm i @solardancer/test

Weekly Downloads

18

Version

0.1.8

License

MIT

Unpacked Size

2.09 kB

Total Files

4

Last publish

Collaborators

  • quentinadam