‚̧Nothing Particularly Magnificent
    Wondering what‚Äôs next for npm?Check out our public roadmap! ¬Ľ

    estype

    0.1.1¬†‚Äʬ†Public¬†‚Äʬ†Published

    estype

    EcmaScript Type Checker.

    Installation

    Installing with npm:

    $ npm install estype --save

    This module does not have dependencies.

    Usage

    In a browser:

    <script src="estype.js"></script>

    In Node.js:

    var type = require('estype');

    Usage example:

    var type = require('./estype');
     
    var today = new Date();
    if (type(today) === 'Date') {
        console.log('It\'s a date');
    }
     
    var obj = {};
    if (type(obj) === 'Object') {
        console.log('It\'s an Object');
    }
     
    class MyClass extends Date {
    }
    var myObj = new MyClass();
    if (type(myObj) === 'MyClass') {
        console.log('It\'s an instance of MyClass');
    }
     
    var result = Math.abs('text');
    if (type(result) === 'NaN') {
        console.log('It\'s not a number');
    }
     

    Testing and complete reference of results

    For testing and as a complete reference of available results, you can see https://github.com/todojs/estype/blob/master/test.js

    Contributor

    Install

    npm i estype

    DownloadsWeekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • avatar