5.0.1 • Published 9 months ago

@ekb1zh/type v5.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Simple tool for getting data type

Install

npm i @ekb1zh/type

Reason

You can't just find out the type of the null, array and object values in runtime. For these three values, the type is always object.

typeof null // => 'object'
typeof [] // => 'object'
typeof {} // => 'object'

This little library solves this problem quickly and efficiently.

import { typeOf } from '@ekb1zh/type'

typeOf(null) // => 'null'
typeOf([]) // => 'array'
typeOf({}) // => 'object'

Also you can use type Kind for type checking.

import { Kind } from '@ekb1zh/type'

const validValue: Kind = 'null' // ok
const invalidValue: Kind = 'bla-bla-bla' // error

The complete list of types that this library defines

null
undefined
boolean
number
string
symbol
bigint
function
array
object
5.0.1

9 months ago

5.0.0

9 months ago

4.0.3

10 months ago

4.0.2

10 months ago

4.0.1

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago