0.2.1 • Published 7 years ago

@jasonxia23/is v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

IS

Downloads Version License

Install

# Using npm
npm install @jasonxia23/is

# Using yarn
yarn add @jasonxia23/is

Note: Updating your npm and clean the cache may fix the errors during installing.

npm install -g npm && npm clean cache

Usage

Library provide a case-insensitive API, which means you can use either isObject or isobject to check whether it is a object.

var is = require('@jasonxia23/is')

is.Object({})
// => true

is.Array([])
// => true

is.Promise(new Promise(() => {}))
// => true

is.Json('{}')
// => true

is.RegExp(/\d/)
// => true

API

Basic

is.Null
is.Undefined
is.Defined
is.String
is.Number
is.Boolean
is.Object
is.Array
is.Function
is.Arguments
is.JSON
is.RegExp
is.Date

ES6

is.Symbol
is.Map
is.Set
is.Promise
is.GeneratorFunction
is.AsyncFunction

Client side check

is.Window
is.HTMLDivElement
is.NodeList
is.HTMLCollection
is.Location
is.DocumentFragment

Test

npm install
npm test

Since async is supported since Node 7.x, update your Node before running test.

TODO

  • is.Document
  • is.Element

License

MIT license.