Nicely Presented Misnomer

    type-compare

    1.0.3 • Public • Published

    type-compare

    Build Status Version

    better simple and accurate to check type of data

    📦 Installation

    npm install type-compare --save

    🔨 Usage

    import typeCompare from 'type-compare';
    // result true
    typeCompare(null, 'null'); // true
    typeCompare(undefined, 'undefined'); // true
    typeCompare(true, 'boolean'); // true
    typeCompare(123, 'number'); // true
    typeCompare('123', 'string'); // true
    typeCompare(Symbol(), 'symbol'); // true
    typeCompare(new Array(), 'array'); // true
    typeCompare(new Object(), 'object.object'); // true
    typeCompare(new Number(), 'object.number'); // true
    typeCompare(new String(), 'object.string'); // true
    typeCompare(new Set(), 'object.set'); // true
    typeCompare(new Map(), 'object.map'); // true
    // result false
    typeCompare(undefined, 'null'); // false
    typeCompare(null, 'undefined'); // false
    typeCompare('true', 'boolean'); // false
    typeCompare('123', 'number'); // false
    typeCompare(123, 'string'); // false
    typeCompare(new Object(), 'array'); // false
    typeCompare(new Array(), 'object'); // false
    typeCompare(new Number('123'), 'object.string'); // false
    typeCompare(new String(123), 'object.number'); // false
    typeCompare(new Set(), 'object.object'); // false
    typeCompare(new Map(), 'object.object'); // false

    Install

    npm i type-compare

    DownloadsWeekly Downloads

    7

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    2.88 kB

    Total Files

    3

    Last publish

    Collaborators

    • clm960227