0.1.0 • Published 5 years ago

the-type v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

the-type

Returns the type of a value

Detecting the type of a value in JavaScript can be frustrating. The typeof operator can yield confusing results (for example typeof null === 'object'). This package attempts to solve this by providing a more sensical type detection.

Installation

npm i the-type

Usage

import theType from 'the-type'

theType(42) // 'number'
theType('hello world') // 'string'
theType(() => {}) // 'function'
theType({}) // 'object'
theType([]) // 'array'
theType(null) // 'null'
theType(undefined) // 'undefined'
theType(Symbol()) // 'symbol'

Local Development

npm run build or yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

npm test or yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

Contributing

This project is open to and encourages contributions! Feel free to discuss any bug fixes/features in the issues. If you wish to work on this project:

  1. Fork this project
  2. Create a branch (git checkout -b new-branch)
  3. Commit your changes (git commit -am 'add new feature')
  4. Push to the branch (git push origin new-branch)
  5. Submit a pull request!