Package Exports
- @dozerg/condition
- @dozerg/condition/dist/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 (@dozerg/condition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Condition
Utilities for preconditions and assertions for TypeScript and JavaScript.
Install
npm i @dozerg/conditionUsage
import { isNonNull, assertNonNull } from '@dozerg/condition';
function foo(p?: string) {
assertNonNull(p);
p.length; // OK, p is string
// ...
const a = [1, undefined, 2]; // a is (number | undefined)[]
const b = a.filter(isNonNull); // b is [1, 2], i.e. number[]
// ...
}APIs
- assertIsBigint
- assertIsBoolean
- assertIsClass
- assertIsNumber
- assertIsString
- assertNonNull
- assertTrue
- assertIsObject
- isBigint
- isBoolean
- isClass
- isNonNull
- isNumber
- isString
- isObject
License
MIT © Zhao DAI daidodo@gmail.com