@eteplus/typeof
v0.1.5
Published
The typeOf method returns a string indicating the type of the value
Downloads
4
Readme
typeof
The
typeOf
method returns a string indicating the type of the value
Install
$ npm install @eteplus/typeof
Usage
Support
Node
andBrowser
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