predictype / predicates/strings / stringState
stringState(
source
,oper
):boolean
Defined in: predicates/strings/stringState.ts:26
Checks the state of a string (empty, not empty, blank, not blank) using the specified operation.
string
The string to check.
The state operation to perform (e.g. ‘is_empty’, ‘is_not_blank’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const str = '';
const str2 = ' ';
stringState(str, 'is_empty'); // true
stringState(str2, 'is_blank'); // true
Supported Operators: