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
- Host: GitHub
- URL: https://github.com/nfour/lutils-typeof
- Owner: nfour
- Created: 2016-02-21T03:23:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-10T10:59:37.000Z (over 9 years ago)
- Last Synced: 2024-04-24T20:43:23.074Z (about 2 years ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
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
```