@gvray/eskit
Version:
A rich and colorful toolkit about typescript and javascript.
25 lines • 750 B
TypeScript
/**
* Checks if a value is a regular expression.
* 检查值是否为正则表达式。
*
* @param value - The value to check / 要检查的值
* @returns True if the value is a regular expression / 如果值是正则表达式则返回true
*
* @example
* ```typescript
* isRegExp(/ab+c/i) // true
* isRegExp(new RegExp('pattern')) // true
* isRegExp(new RegExp('\\d+', 'g')) // true
* isRegExp(/^[a-z]+$/gi) // true
* isRegExp('hello') // false
* isRegExp('/pattern/') // false (string, not regex)
* isRegExp({}) // false
* isRegExp(null) // false
* isRegExp(undefined) // false
* ```
*
* @since 1.0.0
*/
declare const isRegExp: (value: unknown) => value is RegExp;
export default isRegExp;
//# sourceMappingURL=isRegExp.d.ts.map