Home > @taiyuuki/utils > is_regexp
is_regexp() function 
该函数检查给定值是否为正则表达式。
Signature:
typescript
declare function is_regexp(r: any): r is RegExp;declare function is_regexp(r: any): r is RegExp;Parameters 
| Parameter | Type | Description | 
|---|---|---|
| r | any | 参数 r 是 any 类型,这意味着它可以是任何数据类型。 | 
Returns:
r is RegExp
函数 is_regexp 返回一个布尔值,指示输入参数 r 是否为正则表达式 (RegExp)。如果 r 是 RegExp 对象,它返回 true ,否则返回 false 。
Example 
ts
is_regexp(/a/)is_regexp(/a/)