is.modern

0.6.6 • Public • Published

is.modern

License npm version Maintainability Test Coverage Build Status

MayBe on Return constructor functions

usage of node.js...

npm install is.modern

and if use in script Ex.

const is = require("is.modern");

usage of browser

git clone or download is.modern.js;

and if use on web Ex.

<script src="https://cdn.jsdelivr.net/npm/is.modern/is.modern.js"></script>

usage of workers

git clone or download is.modern.js;

and if use on woker Ex.

importScripts(myjsFolder/is.modern.js, ...other)

is(any) return to try any.constructor;

As you like to writing on switch case ...

switch (is(any)) {
    case Object: {
        ...;
        break;
    }

    case Array: {
        ...;
        break;
    }

    case MyClass: {
        ...;
        break;
    }

    case MyConstructor: {
        ...;
        break;
    }

    case String: {
        ...;
        break;
    };

    case Number: {
        ...;
        break;
    };

    case undefined:
    case null: {
        throw new Error();
        break;
    };

    default:{
        
    }
}

Type Check Function

is.array(any);
is.object(any);
is.pure(any);       //<- Check javascript pure Array or Object

is.function(any);
is.generator(any);
is.iterable(any);    //<- Check iterator

is.boolean(any);
is.number(any);
is.string(any);
is.symbol(any);

Value Check Function

is.blank(any);      //<- Check 0 length string
is.defined(any);    //<- Check defined variables
is.nan(any);        //<- Check NaN (Not a Number)
is.null(any);       //<- Check null
is.valid(any);      //<- Check Is valid the value
is.there(any);      //<- Check Object or Array have any entries

Right Inherit Object

is.held(me)(Super)  //<- Check instanceof Super
is.self(any)        //<- Check object have a right constructor infomation

node.js or browser or worker

is.client
is.server
is.worker

Package Sidebar

Install

npm i is.modern

Weekly Downloads

4

Version

0.6.6

License

GPL-3.0

Unpacked Size

41.6 kB

Total Files

4

Last publish

Collaborators

  • johnny_shaman