From 8505d9279b0855990619008b38094d17a0be2aeb Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 2 Feb 2021 00:51:00 +0100 Subject: :art: Body Parser error --- src/util/instanceOf.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/util/instanceOf.ts') diff --git a/src/util/instanceOf.ts b/src/util/instanceOf.ts index 341374b7..5035e4c9 100644 --- a/src/util/instanceOf.ts +++ b/src/util/instanceOf.ts @@ -95,7 +95,7 @@ export function instanceOf( return true; throw new FieldError("BASE_TYPE_CHOICES", t("common:field.BASE_TYPE_CHOICES", { types: type.types })); case Email: - if ((type).check()) return true; + if (new Email(value).check()) return true; throw new FieldError("EMAIL_TYPE_INVALID_EMAIL", t("common:field.EMAIL_TYPE_INVALID_EMAIL")); case Date: value = new Date(value); @@ -143,13 +143,13 @@ export function instanceOf( let newKey = key; const OPTIONAL = key.startsWith(OPTIONAL_PREFIX); if (OPTIONAL) newKey = newKey.slice(OPTIONAL_PREFIX.length); - errors[key] = {}; + errors[newKey] = {}; return ( instanceOf(type[key], value[newKey], { path: `${path}.${newKey}`, optional: OPTIONAL, - errors: errors[key], + errors: errors[newKey], t, ref: { key: newKey, obj: value }, }) === true -- cgit 1.5.1