@jkroso/type

2.0.0 • Public • Published

type

Type assertions aka less-broken typeof.

API

var type = require('type')
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(new Uint8Array) // => 'bit-array'
type(document.createElement('div')) // => 'element'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    11
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    11
  • 1.1.1
    4,881

Package Sidebar

Install

npm i @jkroso/type

Weekly Downloads

4,892

Version

2.0.0

License

MIT

Last publish

Collaborators

  • jkroso