This package has been deprecated

Author message:

this package has been deprecated (renamed), please use aire-checker instead

aire-check

0.1.1 • Public • Published

aire-check

Light-weight utility module for comparing and validating ES6 primitive and reference data types: Array, Boolean, Function, Number, Object, String, Symbol, Null, Undefined.

Installation

Using npm:

$ npm install --save aire-check

Using yarn:

$ yarn add aire-check

Usage

In Node.js:

import Check from 'aire-check'

let check = Check.equals(100, '100')  // true
check = Check.strictEquals(100, '100')  // false
check = Check.equalsIgnoreCase('hello', 'HELLO')  // true
check = Check.isArray('hello')  // false
check = Check.isArray(['hello'])  // true
check = Check.isEmpty({})  // true
check = Check.isNullOrUndefined(null)  // true
check = Check.isNullOrUndefined(undefined)  // true
check = Check.isSymbol({'value': true})  // false
check = Check.isSymbol(Symbol('hello'))  // true
check = Check.numbersOnly(100, 200, '300', 400)  // throws 'TypeError'
check = Check.numbersOnly(100, 200, 300, 400)  // no error
check = Check.booleansOnly(true, false, false, true, 'false', true)  // throws 'TypeError'
check = Check.booleansOnly(true, false, false, true, false, true)  // true
check = Check.stringsArrayObjectsOnly('hello', [1,2,3], 100, {'value': true})  // throws 'TypeError'
check = Check.stringsArrayObjectsOnly('hello', [1,2,3], {'value': true})  // true

Public static functions

  Check.equals(subject, target)
  Check.strictEquals(subject, target)
  Check.equalsIgnoreCase(subject, target)
  Check.isGreaterThan(subject, target)
  Check.isGreaterThanOrEqualTo(subject, target)
  Check.isLessThan(subject, target)
  Check.isLessThanOrEqualTo(subject, target)
  Check.isArray(subject)
  Check.isBoolean(subject)
  Check.isDate(subject)
  Check.isEmpty(subject)
  Check.isFunction(subject)
  Check.isNull(subject)
  Check.isUndefined(subject)
  Check.isNullOrUndefined(subject)
  Check.isNumber(subject)
  Check.isObject(subject)
  Check.isString(subject)
  Check.isSymbol(subject)
  Check.arraysOnly(...args)
  Check.argsWithValuesOnly(...args)
  Check.booleansOnly(...args)
  Check.datesOnly(...args)
  Check.definedArgsOnly(...args)
  Check.numbersOnly(...args)
  Check.objectsOnly(...args)
  Check.stringsArrayObjectsOnly(...args)
  Check.stringsOnly(...args)
  Check.symbolsOnly(...args)

Package Sidebar

Install

npm i aire-check

Weekly Downloads

8

Version

0.1.1

License

MIT

Unpacked Size

25.7 kB

Total Files

5

Last publish

Collaborators

  • laekettavong