# @sa0001/type-of

> [NPM][https://www.npmjs.com/package/@sa0001/type-of]

Latest version **0.0.7** (published 2021-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sa0001/type-of
pnpm add @sa0001/type-of
yarn add @sa0001/type-of
bun add @sa0001/type-of
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2021-01-23 |
| First published | 2018-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | sa0001 |
| Maintainers | sa0001 |

## Links

- npm: https://www.npmjs.com/package/@sa0001/type-of
- Repository: https://github.com/sa-0001/type-of-js
- Homepage: https://github.com/sa-0001/type-of-js#readme
- Issues: https://github.com/sa-0001/type-of-js/issues
- npm.io page: https://npm.io/package/@sa0001/type-of

## Recent versions

- 0.0.7 (latest) — 2021-01-23
- 0.0.6 — 2020-09-15
- 0.0.5 — 2020-05-21
- 0.0.4 — 2020-01-13
- 0.0.3 — 2019-05-14
- 0.0.2 — 2018-05-15

## README

# @sa0001/type-of

[NPM][https://www.npmjs.com/package/@sa0001/type-of]

A library which returns an accurate type for any possible value.

The following standard types are known to work correctly:
* arguments
* array
* boolean
* date
* error
* float32array
* float64array
* function
* int16array
* int32array
* int8array
* map
* null
* number
* object
* promise
* regexp
* set
* string
* symbol
* uint16array
* uint32array
* uint8array
* uint8clampedarray
* undefined
* weakmap

However because `Object.prototype.toString.call(val)` is used, a type does not have to be in this list for it to return the correct value.

## Install

```bash
npm install @sa0001/type-of
```

## Usage

```javascript
const typeOf = require('@sa0001/type-of')

typeOf(arguments) // "arguments"
typeOf(['a',1]) // "array"
typeOf(true) // "boolean"
typeOf(new Date()) // "date"
typeOf(new Error()) // "error"
typeOf(function(){}) // "function"
typeOf(null) // "null"
typeOf(1.23) // "number"
typeOf({a:1}) // "object"
typeOf(new Promise()) // "promise"
typeOf(/\w/) // "regexp"
typeOf(new Set()) // "set"
typeOf('abc') // "string"
typeOf(Symbol('a')) // "symbol"
typeOf(undefined) // "undefined"
```

## License

[MIT](http://vjpr.mit-license.org)

---
_Source: https://npm.io/package/@sa0001/type-of · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
