-
-
Notifications
You must be signed in to change notification settings - Fork 0
regexp
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
function isRegExp(it: unknown): it is RegExp;
Check if the given value is a regular expression, which is an object that represents a pattern of text that can be used to perform pattern matching with strings.
Name | Info |
---|---|
it |
The value to check. |
true
if the value is a regular expression, false
otherwise.
Standard
import { isRegExp } from "jsr:@nick/is/regexp";
const regex = /foo/;
console.log(isRegExp(regex)); // true
console.log(isRegExp("foo")); // false