What
better-typeof
is a single JavaScript function that returns the type of a value. This is mainly a learning exercise. You should probably use kind-of instead.
Why
The native JavaScript typeof
operator is drunk and will shout "object"
at almost any value you give it.
typeof {}; // objecttypeof /a/; // objecttypeof null; // objecttypeof ; // objecttypeof 'foo'; // object
Installation
npm install --save better-typeof
Usage
const betterTypeof = ; ; // object; // regexp; // null; // array; // string