package
Cross-browser type assertions (less broken typeof)
npm install type-componentGitHub-flavored package documentation.
Across all versions, last 30 days.
691,461 in 30 days
Runtime metadata.
Tagged topics.
Registry package owners.
Type assertions aka less-broken typeof.
var type = require('type');
var obj = new Date;
if (type(obj) == 'date') ...type(new Date) == 'date'
type({}) == 'object'
type(null) == 'null'
type(undefined) == 'undefined'
type("hey") == 'string'
type(true) == 'boolean'
type(false) == 'boolean'
type(12) == 'number'
type(type) == 'function'
type(/asdf/) == 'regexp'
type((function(){ return arguments })()) == 'arguments'
type([]) == 'array'MIT