predictype / arrays / arrayState
arrayState(
source
,oper
):boolean
Defined in: predicates/arrays/arrayState.ts:24
Checks if an array is empty or not, using the specified operation.
any
[]
The source array.
The state operation to perform (e.g. ‘is_empty’, ‘is_not_empty’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const arr1 = [];
const arr2 = [1, 2, 3];
arrayState(arr1, 'is_empty'); // true
arrayState(arr2, 'is_not_empty'); // true
Supported Operators: