effect-io-ai

Package: effect
Module: RegExp

RegExp.isRegExp

Checks whether a value is a RegExp.

When to use

Use to validate unknown input before treating it as a regular expression.

Example (Checking for regular expressions)

import { RegExp } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(RegExp.isRegExp(/a/), true)
assert.deepStrictEqual(RegExp.isRegExp("a"), false)

Signature

declare const isRegExp: (input: unknown) => input is RegExp

Source

Since v3.9.0