From 77f68a0647ef2f0116e249fae9fc9cebc80db9d2 Mon Sep 17 00:00:00 2001 From: Vipin Paneru <102546189+PaneruVipin@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:03:45 +0530 Subject: [PATCH] Update validation.js --- src/validation.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/validation.js b/src/validation.js index ebab859..7b42ce2 100644 --- a/src/validation.js +++ b/src/validation.js @@ -7,14 +7,12 @@ const validation = (body, rules) => { ruleKeys?.forEach((key, i) => { const schemaList = rules?.[key].split("|").map((str) => str - ?.split(" ") - ?.filter((subStr) => subStr != false) - .join("") + ?.trim() ); let returnedValue; schemaList?.forEach((schema, i) => { - const rule = schema?.split(":")?.[0]; - const ruleValue = schema?.split(":")?.[1]; + const rule = schema?.split(":")?.[0]?.trim(); + const ruleValue = schema?.split(":")?.[1]?.trim(); if (i) { if(schemaList.includes("trim")){ const newData = ruleHandlers?.["trim"](