JSPM

type-of

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 582099
  • Score
    100M100P100Q170641F
  • License MIT

Type assertions aka less-broken typeof.

Package Exports

  • type-of

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (type-of) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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