From cd9a20fe41383f387cfb4f03642625a69fe3d260 Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Sat, 5 Oct 2019 19:48:01 +0200 Subject: [PATCH] fix: ensure that building arrays does not happen to objects with length prop closes #2398 --- src/validate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validate.ts b/src/validate.ts index 3bac21dd7..a9650755b 100644 --- a/src/validate.ts +++ b/src/validate.ts @@ -295,7 +295,7 @@ function _buildParams( let definedRules: RuleParamConfig[]; // collect the params schema. - if (!defined || defined.length < provided.length) { + if (!defined || (defined.length < provided.length && Array.isArray(provided))) { let lastDefinedParam: RuleParamConfig; // collect any additional parameters in the last item. definedRules = provided.map((_: any, idx: number) => {