0.0.1 • Published 12 years ago

type-component v0.0.1

Weekly downloads
53,085
License
-
Repository
-
Last release
12 years ago

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