type-of
Type assertions aka less-broken typeof.
Last updated 7 years ago by forbeslindesay .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install type-of 
SYNC missed versions from official npm registry.

type-of

Type assertions aka less-broken typeof.

Build Status Dependency Status NPM version

Example

var type = require('type-of')

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'
type(document.createElement('div')) == 'element'

License

MIT

Current Tags

  • 2.0.1                                ...           latest (7 years ago)

2 Versions

  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 4
This Week 154
This Month 1,574
Last Day 150
Last Week 882
Last Month 4,033
Dependencies (0)
None
Dev Dependencies (1)
Dependents (156)

Copyright 2014 - 2016 © taobao.org |