https://github.com/eteplus/typeof
The typeOf method returns a string indicating the type of the value
https://github.com/eteplus/typeof
javascript nodejs
Last synced: 12 months ago
JSON representation
The typeOf method returns a string indicating the type of the value
- Host: GitHub
- URL: https://github.com/eteplus/typeof
- Owner: eteplus
- License: mit
- Created: 2018-04-02T07:02:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T03:06:57.000Z (over 8 years ago)
- Last Synced: 2024-05-01T12:41:39.711Z (about 2 years ago)
- Topics: javascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typeof
[](https://travis-ci.org/eteplus/typeof) [](https://coveralls.io/github/eteplus/typeof?branch=master) [](https://www.npmjs.com/package/@eteplus/typeof) [](https://www.npmjs.com/package/@eteplus/typeof) [](https://standardjs.com) [](https://github.com/eteplus/typeof/blob/master/LICENSE)
> The `typeOf` method returns a string indicating the type of the value
## Install
```bash
$ npm install @eteplus/typeof
```
## Usage
> Support `Node` and `Browser`
```js
const typeOf = require('@eteplus/typeof')
typeOf() // => 'Undefined'
typeOf('🌟') // => 'String'
typeOf(+'a') // => 'NaN'
typeOf(new WeakMap()) // => 'WeakMap'
```
```html
var type = typeOf('🌟')
console.log(type) // => 'String'
```
## API
### typeOf(value)
Returns the type of value
Types:
- Null
- Undefined
- NaN
- Arguments
- Number
- String
- Array
- Object
- Date
- Boolean
- Symbol
- Map
- WeakMap
- Set
- WeakSet
- Function
- RegExp
- Promise
- Error
- ArrayBuffer
- DataView
- Int8Array
- Uint8Array
- Uint8ClampedArray
- Int16Array
- Uint16Array
- Int32Array
- Uint32Array
- Float32Array
- Float64Array
## Author
**typeOf** © [ETEPLUS](https://github.com/eteplus), Released under the [MIT](https://github.com/eteplus/typeof/blob/master/LICENSE) License