isRegExp
Checks if the given value is a RegExp. Instances from [other realms][1] are also supported. [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms
Usage
isRegExp(/abc/); // => trueisRegExp("abc"); // => false
Installation
npx atmx add helper is-reg-exp
Copy and paste the following method into @/utils/helpers/undefined.ts
:
import { isTagged } from "@/helpers/is-tagged.ts";
/*** Checks if the given value is a RegExp.** Instances from [other realms][1] are also supported.** [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms** @example* isRegExp(/abc/) // => true* isRegExp('abc') // => false*/export function isRegExp(value: unknown): value is RegExp {return isTagged(value, "[object RegExp]");}