Skip to content

samualtnorman/assert

Repository files navigation

Samual's Assertion Library

Requires Node.js 20.10+, 22.0+, 24.0+, or above.

Example

import { assert, expect } from "@samual/assert"

// Throws if `someValue` is falsy
assert(someValue)

// `expect()` throws if `someOtherValue` is nullish or just returns the value
doSomething(expect(someOtherValue))
// This is like doing `doSomething(someOtherValue!)` in TypeScript but enforced
// in JavaScript

This package is available on JSR and NPM.

About

Assertion library.

Topics

Resources

License

Stars

Watchers

Forks