Search Docs
use(rule: RuleName | RegExp): this
not(): this
isValid(): boolean
Checker
通过方法链支持验证字符串是否符合正则表达式模式或注册规则。
.not()
import { regex } from 'funtool'; // 基础验证 const isValidEmail = regex.checker('test@example.com').use(/^\S+@\S+\.\S+$/).isValid(); // 使用注册规则 const isValidPassword = regex.checker('test@example.com').use('email').isValid();
class Checker { constructor(input: string); use(rule: RuleName | RegExp): this; not(): this; isValid(): boolean; }
rule
true
false