@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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i @solardancer/test

    Weekly Downloads

    8

    Version

    0.1.8

    License

    MIT

    Unpacked Size

    2.09 kB

    Total Files

    4

    Last publish

    Collaborators

    • quentinadam