A function check real typeof value in JavaScript.
npm i type-detail
# or
yarn add type-detail
import typeDetail from 'type-detail';
// or import { typeDetail } from 'type-detail';
typeDetail(1); // 'integer'
typeDetail(1.1); // 'float'
typeDetail([1, 2, 3]); // 'array'
typeDetail(class Cat {}); // 'class'
typeDetail(async function () {}); // 'promise'
typeDetail(function* () {}); // 'generator'
- array
- arrayBuffer
- BigInt64Array
- BigUint64Array
- blob
- boolean
- dataView
- date
- error
- float
- float32Array
- float64Array
- function
- generator
- infinity
- int16Array
- int32Array
- int8Array
- integer
- map
- NaN
- null
- object
- promise
- regExp
- set
- string
- symbol
- uint16Array
- uint32Array
- uint8Array
- uint8ClampedArray
- undefined
- weakMap
- weakSet