An open API service indexing awesome lists of open source software.

https://github.com/nfour/lutils-typeof

Reliable type checks for javascript primitives
https://github.com/nfour/lutils-typeof

Last synced: over 1 year ago
JSON representation

Reliable type checks for javascript primitives

Awesome Lists containing this project

README

          

# typeOf `lutils-typeof`
Reliable type checks for javascript primitives

`npm install lutils-typeof`

```js
import typeOf from "lutils-typeof"

// Returns a string
typeOf({}) // "object"
typeOf(5000) // "number"
typeOf(NaN) // "nan"

// Returns a boolean
typeOf.Object({}) // true
typeOf.Object(null) // false
typeOf.Boolean(false) // true
typeOf.String("string") // true
typeOf.Function(typeOf) // true
typeOf.Array([]) // true
typeOf.Number(600) // true
typeOf.Number(Infinity) // true
typeOf.Date(new Date()) // true
typeOf.RegExp(/test/i) // true
typeOf.NaN(NaN) // true

typeOf.null(null) // true
typeOf.Null(null) // true
typeOf.undefined(undefined) // true
typeOf.Undefined(undefined) // true
```