Skip to content

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 RegExp
export isRegExp

Checks if the given value is a RegExp.

Instances from other realms are also supported.

@seehttps://radashi.js.org/reference/typed/isRegExp

@example

isRegExp(/abc/) // => true
isRegExp('abc') // => false

@version12.2.0

isRegExp
(/.+/) // true
import _
_
.
function isRegExp(value: unknown): value is RegExp
export isRegExp

Checks if the given value is a RegExp.

Instances from other realms are also supported.

@seehttps://radashi.js.org/reference/typed/isRegExp

@example

isRegExp(/abc/) // => true
isRegExp('abc') // => false

@version12.2.0

isRegExp
(new
var RegExp: RegExpConstructor
new (pattern: RegExp | string, flags?: string) => RegExp (+2 overloads)
RegExp
('.+')) // true
import _
_
.
function isRegExp(value: unknown): value is RegExp
export isRegExp

Checks if the given value is a RegExp.

Instances from other realms are also supported.

@seehttps://radashi.js.org/reference/typed/isRegExp

@example

isRegExp(/abc/) // => true
isRegExp('abc') // => false

@version12.2.0

isRegExp
(new (class extends
var RegExp: RegExpConstructor
RegExp
{})('.+')) // true