1.0.7 • Published 4 years ago

@zcorky/is v1.0.7

Weekly downloads
14
License
MIT
Repository
github
Last release
4 years ago

is

NPM version Coverage Status Dependencies Build Status license issues

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