Monster.Constraints. IsArray

Constraints are used to define conditions that must be met by the value of a variable.

The uniform API of the constraints allows chains to be formed.

Constructor

new IsArray()

A constraint to check if a value is an array

Since
  • 1.3.0
License
  • AGPLv3
Example
import {IsArray} from '@schukai/monster/source/constraints/isarray.mjs';

new IsArray()
    .isValid([])
    .then(() => console.log(true));
// ↦ true

new IsArray()
    .isValid(99)
    .catch(e => console.log(e));
// ↦ 99

Members

(static) instanceSymbol

This method is called by the instanceof operator.

This method is called by the instanceof operator.

Since
  • 2.1.0

Methods

isValid(value) → {Promise}

this method return a promise containing the result of the check.

this method return a promise containing the result of the check.

Parameters:
NameTypeDescription
value*
Returns:
Type: 
Promise