predictype / arrays / arraySize
arraySize(
source
,oper
,target
):boolean
Defined in: predicates/arrays/arraySize.ts:29
Checks the size of an array against a target value, using the specified operation.
any
[]
The source array.
The size operation to perform (e.g. ‘length_equals’, ‘length_greater_than’).
number
The target size to compare against the array’s length.
boolean
True if the size check is valid according to the operator, otherwise false.
If the operation is not recognized.
const arr = [1, 2, 3];
const len1 = 3;
const len2 = 2;
arraySize(arr, 'length_equals', len1); // true
arraySize(arr, 'length_greater_than', len2); // true
Supported Operators: