:zap: 适用于 NodeJS 的最快 JS 验证库
为了实现最低成本/最高性能的修改,快速验证器使用 Function 构造函数创建和编译函数。重要的是要区分这一点与运行时 eval 的危险。在创建编译为函数的验证方案时,没有用户输入参与。这与正常编写代码并由 V8 以常规方式编译一样安全。
…如果您要在出现第一个错误后立即停止:
const v = new Validator({ haltOnFirstError: true });<script src="https://unpkg.com/fastest-validator"></script>const v = new FastestValidator();
const schema = {
id: { type: "number", positive: true, integer: true },
name: { type: "str
[Try it on Repl.it](https://repl.it/@icebob/fastest-validator-fast)暂无开放 Issues,或尚未同步最近议题。