isRegExp
Returns true for RegExp instances
128 bytes
Usage
Returns true for RegExp instances, even if they are subclass instances or from
other realms.
import * as import _
_ from 'radashi'
import _
_.function isRegExp(value: unknown): value is RegExpexport isRegExp
Checks if the given value is a RegExp.
Instances from other realms are also supported.
isRegExp(/.+/) // trueimport _
_.function isRegExp(value: unknown): value is RegExpexport isRegExp
Checks if the given value is a RegExp.
Instances from other realms are also supported.
isRegExp(new var RegExp: RegExpConstructornew (pattern: RegExp | string, flags?: string) => RegExp (+2 overloads)
RegExp('.+')) // trueimport _
_.function isRegExp(value: unknown): value is RegExpexport isRegExp
Checks if the given value is a RegExp.
Instances from other realms are also supported.
isRegExp(new (class extends var RegExp: RegExpConstructor
RegExp {})('.+')) // true