@tiaanduplessis/type

Basic type checking

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
21Jun 2, 2019Apr 28, 2018Minified + gzip package size for @tiaanduplessis/type in KB

Readme

@tiaanduplessis/type

package version package downloads standard-readme compliant package license make a pull request

Basic type checking

Table of Contents

Install

This project uses node and npm.

$ npm install @tiaanduplessis/type
$ # OR
$ yarn add @tiaanduplessis/type

Usage

import * as type from '@tiaanduplessis/type'

type.isArr([]) // true
type.isArr(new Array(10)) // true

type.isBool(true) // true
type.isBool(false) // true
type.isBool(new Boolean()) // true

type.isDate(new Date()) // true

type.isEmpty([]) // true
type.isEmpty('') // true
type.isEmpty({}) // true

type.isErr(new Error('Error')) // true

type.isJSON('{"foo": true}') // true

type.isFunc(() => {}) // true
type.isFunc(function noop() {}) // true

type.isStr('')
type.isStr('true')

type.isUndef(undefined) // true

type.isSym(Symbol('test')) // true

type.isObj({}) // true
type.isObj({foo: true}) // true

type.isProm(Promise.resolve({})) // true
type.isProm(new Promise(() => {})) // true

type.isNull(null) // true

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am 'Add some feature'
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.