predictype / predicates/regexps/regexpState / regexpState
regexpState(
source,oper):boolean
Defined in: predicates/regexps/regexpState.ts:33
Checks the state of a RegExp (flags and pattern shape) using the specified operation.
RegExp
The RegExp to check.
The state operation to perform (e.g. ‘is_global’, ‘has_indices’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const sourceA = /foo/gi;
const sourceB = new RegExp('');
regexpState(sourceA, 'is_global'); // true
regexpState(sourceA, 'is_ignore_case'); // true
regexpState(sourceB, 'is_empty_pattern'); // true
Supported Operators: