Skip to main content
isRegExp - util - Node documentation
function isRegExp

Usage in Deno

import { isRegExp } from "node:util";
isRegExp(object: unknown): object is RegExp
Deprecated

Since v4.0.0 - Deprecated

Returns true if the given object is a RegExp. Otherwise, returns false.

import util from 'node:util';

util.isRegExp(/some regexp/);
// Returns: true
util.isRegExp(new RegExp('another regexp'));
// Returns: true
util.isRegExp({});
// Returns: false

Parameters

object: unknown

Return Type

object is RegExp
Back to top