type-component

0.0.1 • Public • Published

type

Type assertions aka less-broken typeof.

Example

var type = require('type');
 
var obj = new Date;
if (type(obj) == 'date') ...

API

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'

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    258,557
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    258,557

Package Sidebar

Install

npm i type-component

Weekly Downloads

214,195

Version

0.0.1

License

none

Last publish

Collaborators

  • tjholowaychuk
  • ianstormtaylor