Package Exports
- @santi100/assertion-lib
- @santi100/assertion-lib/cjs
- @santi100/assertion-lib/cjs/index.js
- @santi100/assertion-lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@santi100/assertion-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Santi's Assertion Library (JavaScript)
This is an assertion library that asserts types and conditions.
Usage
Importing from a JavaScript File
Via NPM
Import @santi100/assertion-lib (for ESM) or @santi100/assertion-lib/cjs (for CJS).
Via Source Control
Import ./assertion-lib/index.js (ESM) or ./assertion-lib/cjs/index.js (CJS).
Installation
Via NPM
- Run
npm install @santi100/assertion-lib,yarn add @santi100/assertion-lib, orpnpm install @santi100/assertion-lib, depending on what package manager you use in your project.
Via Source Control
- Run
git clone https://github.com/santi100a/assertion-lib. - Enter the directory and run
npm install,yarn install, orpnpm installto install dependencies.
Exported Members
assert(condition: boolean, { expected, actual, operator }?: AssertOptionalParams): void; Asserts that condition is truthy. Throws a (custom) AssertionError otherwise.
assertType(val: unknown, expectedType: string): void; Asserts that the type of val is expectedType. Throws an AssertionError otherwise.