1.0.4 • Published 10 months ago

js.typeof v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 months ago

js.typeof

A simpler, better, and more lightweight Javascript data type checker.

In a nutshell

js.type is an alternative to typeof that actually does something useful and is pretty lightweight, compared to other alternatives. Results are Capitalized to differentiate them from native Javascript typeof results.

e.g., 'String' instead of 'string'.

Examples:

    const typeOf = require ('js.typeof');
    
    typeOf({a: 4}) => "Object"
    typeOf([1, 2, 3]) => "Array"
    (function() { return typeOf(arguments) })() => "Arguments"
    typeOf(new ReferenceError) => "Error"
    typeOf(new Date) => "Date"
    typeOf(/a-z/) => "RegExp"
    typeOf(Math) => "Math"
    typeOf(JSON) => "JSON"
    typeOf(new Number(4)) => "Integer"
    typeOf(new Number(4.5)) => "Float"
    typeOf(new String("abc")) => "String"
    typeOf(new Boolean(true)) => "Boolean"
    typeOf(1/0) => "Infinity"
    typeOf(NaN) => "NaN"

TO-DOs

I don't know, you tell me.

Credit

js.type wouldn't be possible without my good friend, Oibaf. Also, my incessant laziness and frustration with simple data type checking helped a bit.

License

Licensed under MIT (Mother Insured Task) - a.k.a. contribute please, but no criticizing Oibaf's mother's cooking or she will beat you senseless with an old wooden soup ladel.

Copyleft (c) 2019 by Nosaj and Oibaf - "we code, you like, that how work"

1.0.4

10 months ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago