predictype / predicates/strings/stringSize / stringSize
stringSize(
source
,oper
,target
):boolean
Defined in: predicates/strings/stringSize.ts:29
Checks the size (length) of a string using the specified operation.
string
The string to check.
The size operation to perform (e.g. ‘length_equals’, ‘length_greater_than’).
number
The length to compare against.
boolean
True if the size check is valid according to the operator, otherwise false.
If the operation is not recognized.
const str = 'hello';
const len1 = 5;
const len2 = 3;
stringSize(str, 'length_equals', len1); // true
stringSize(str, 'length_greater_than', len2); // true
Supported Operators: