@zcorky/is
v1.0.7
Published
A TypeCheck library
Downloads
1,437
Readme
is
A TypeCheck lib
Install
$ npm install @zcorky/is
Usage
// typescript
import * as is from '@zcorky/is';
// primitive
is.nul(null);
is.undefined(undefined);
is.string('');
is.number(1);
is.boolean(false);
is.symbol(Symbol());
// primitive
is.primitive(true);
// array
is.array([]);
// function
is.func(() => null);
// object
is.object({});
// promise
is.promise(promise);
// date
is.date(new Date());
is.date(+ new Date());
is.date(new Date().toString());
// integer
is.integer(10);
is.int(10);
is.safeInteger(Math.pow(2, 53) - 1);
is.safeInt(Math.pow(2, 53) - 1);
// float
is.float(10.1);
Relatived
- is - Type check values: is.string('🦄') //=> true
- joi - Object schema validation.
- ajv - The fastest JSON Schema Validator.
- parameter - A parameter verify tools.
- type-is - Infer the content-type of a request.
License
MIT © Moeover