@arpinum/defender

Assertions to do some runtime type checking

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
00Jul 29, 2021Apr 5, 2018Minified + gzip package size for @arpinum/defender in KB

Readme

@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:

const { assert } = require("@arpinum/defender");

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

Simple validation returning a boolean:

const { is } = require("../build");

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

More examples in examples.

Docs

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.