Skip to content

Commit

Permalink
perf(validator): improve validate perf (#950)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Jul 5, 2020
1 parent da90ef1 commit 0162788
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,12 @@ class FormValidator {
let errors = []
let warnings = []
try {
const nodeKey = pattern.toString()
const node = this.nodes[nodeKey]
const matchNodes = node ? { [nodeKey]: node } : this.nodes
await Promise.all(
reduce<ValidateNodeMap, ValidateNode>(
this.nodes,
matchNodes,
(buf, validator, path) => {
if (
isFn(this.matchStrategy)
Expand Down

0 comments on commit 0162788

Please sign in to comment.