From 537780aceaf6e8fef85199989ff09d39b7a1cd5b Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 7 Jun 2022 17:21:06 +0300 Subject: [PATCH] Default value should not be overridden --- src/utils/input-utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/input-utils.ts b/src/utils/input-utils.ts index ec51bf1..cf39704 100644 --- a/src/utils/input-utils.ts +++ b/src/utils/input-utils.ts @@ -38,15 +38,15 @@ function init(root: InputObject, path: string[], value: string): void { } export function mapStringInput(value: any, defaultValue = ""): string { - return mapInput(value, defaultValue ?? "", null, "string"); + return mapInput(value, defaultValue, null, "string"); } export function mapObjectInput(value: any, defaultValue: object = null): object { - return mapInput(value, defaultValue ?? null, null, "object"); + return mapInput(value, defaultValue, null, "object"); } export function mapNumberInput(value: any, defaultValue = 0): number { - return mapInput(value, defaultValue ?? 0, { + return mapInput(value, defaultValue, { string: x => { const num = +x; return isNaN(num) ? undefined : num; @@ -55,7 +55,7 @@ export function mapNumberInput(value: any, defaultValue = 0): number { } export function mapBooleanInput(value: any, defaultValue = false): boolean { - return mapInput(value, defaultValue ?? false, { + return mapInput(value, defaultValue, { string: x => { const strValue = x.trim().toLowerCase(); return (