Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
/ js-defender Public archive

Assertions to do some runtime type checking

License

Notifications You must be signed in to change notification settings

arpinum-oss/js-defender

Repository files navigation

@arpinum/defender Build Status

Every absurdity has a champion to defend it.
Oliver Goldsmith

@arpinum/defender is a collection of assertions to do some runtime type checking.

Installation

npm install @arpinum/defender --save

Examples

Assertion throwing exception when not satisfied:

import { assert } from "@arpinum/defender";

assert("hello").toBeANumber(); // throws: value must be a number

Simple validation returning a boolean:

import { is } from "@arpinum/defender";

is("hello").aNumber(); // false

More examples in examples.

Docs

License

MIT

About

Assertions to do some runtime type checking

Resources

License

Stars

Watchers

Forks

Packages

No packages published