Node's Perpetuum Mobile

    @zcorky/is
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.7 • Public • Published

    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

    Keywords

    none

    Install

    npm i @zcorky/is

    DownloadsWeekly Downloads

    656

    Version

    1.0.7

    License

    MIT

    Unpacked Size

    17.1 kB

    Total Files

    55

    Last publish

    Collaborators

    • uniquecolesmith