From 822f8da67af95e5d12ae3e3988b57709cb39b57c Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Mon, 20 Sep 2021 19:34:49 -0700 Subject: [PATCH] fix: Dont run criteria if never flag is set. --- optimal/src/createSchema.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/optimal/src/createSchema.ts b/optimal/src/createSchema.ts index 4557783..ffce00c 100644 --- a/optimal/src/createSchema.ts +++ b/optimal/src/createSchema.ts @@ -60,7 +60,8 @@ function validate( validators.forEach((test) => { if ( (test.skipIfNull && value === null) || - (test.skipIfOptional && !state.required && value === state.defaultValue) + (test.skipIfOptional && !state.required && value === state.defaultValue) || + state.never ) { return; }