@eteplus/typeof

0.1.5 • Public • Published

typeof

Build Status Coverage Status NPM Version NPM Download JavaScript Style Guide LICENSE

The typeOf method returns a string indicating the type of the value

Install

$ npm install @eteplus/typeof

Usage

Support Node and Browser

const typeOf = require('@eteplus/typeof')

typeOf() // => 'Undefined'

typeOf('🌟') // => 'String'

typeOf(+'a') // => 'NaN'

typeOf(new WeakMap()) // => 'WeakMap'
<script src="dist/typeof.js"></script>
<script>
  var type = typeOf('🌟')
  console.log(type) // => 'String'
</script>

API

typeOf(value)

Returns the type of value

Types:

  • Null
  • Undefined
  • NaN
  • Arguments
  • Number
  • String
  • Array
  • Object
  • Date
  • Boolean
  • Symbol
  • Map
  • WeakMap
  • Set
  • WeakSet
  • Function
  • RegExp
  • Promise
  • Error
  • ArrayBuffer
  • DataView
  • Int8Array
  • Uint8Array
  • Uint8ClampedArray
  • Int16Array
  • Uint16Array
  • Int32Array
  • Uint32Array
  • Float32Array
  • Float64Array

Author

typeOf © ETEPLUS, Released under the MIT License

Readme

Keywords

Package Sidebar

Install

npm i @eteplus/typeof

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

255 kB

Total Files

15

Last publish

Collaborators

  • eteplus