elzup / kindof

advanced typeof for 10 type

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kindof

advanced typeof for 10 type

10 type from JSON Data Type and typeof.

JSON: 6 type string | number | object | array | boolean | null typeof: 8 type undefined | boolean | number | bigint | string | symbol | function | object

example vlaue key typeof JSON description
undefined "undefined" o
true "boolean" o o
123 "number" o o
1000n "bigint" o ES2020
"hello" "string" o o
Symbol('s') "symbol" o ES2015
() => 0 "function" o
{ a: 1 } "object" o o
[1, 2, 3] "array" o typoef => "object"
null "null" o typoef => "object"

Install


$ npm install @elzup/kindof

Usage

const { kindof } = require('@elzup/kindof')

kindof(123)
//=> 'number'

kindof([1, 2])
//=> 'array'

kindof(null)
//=> 'null'

MIT © anozon

About

advanced typeof for 10 type

License:MIT License


Languages

Language:TypeScript 100.0%