util-ex
Version:
Browser-friendly enhanced util fully compatible with standard node.js
30 lines (29 loc) • 691 B
TypeScript
/**
* Checks if the given value is a RegExp instance
* This function specifically determines whether the provided value is an actual RegExp object instance,
* not just any object that might resemble a regular expression
* @param {*} v - The value to check
* @returns {boolean} Returns true if v is a RegExp instance, false otherwise
*
* @example
* // returns true
* isRegExp(/abc/);
*
* @example
* // returns true
* isRegExp(new RegExp('abc'));
*
* @example
* // returns false
* isRegExp('abc');
*
* @example
* // returns false
* isRegExp({});
*
* @example
* // returns false
* isRegExp(null);
*/
export function isRegExp(v: any): boolean;
export default isRegExp;