mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-12-29 10:04:49 -05:00
Default value should not be overridden
This commit is contained in:
parent
0d76fa5eef
commit
537780acea
1 changed files with 4 additions and 4 deletions
|
@ -38,15 +38,15 @@ function init(root: InputObject, path: string[], value: string): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapStringInput(value: any, defaultValue = ""): string {
|
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 {
|
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 {
|
export function mapNumberInput(value: any, defaultValue = 0): number {
|
||||||
return mapInput(value, defaultValue ?? 0, {
|
return mapInput(value, defaultValue, {
|
||||||
string: x => {
|
string: x => {
|
||||||
const num = +x;
|
const num = +x;
|
||||||
return isNaN(num) ? undefined : num;
|
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 {
|
export function mapBooleanInput(value: any, defaultValue = false): boolean {
|
||||||
return mapInput(value, defaultValue ?? false, {
|
return mapInput(value, defaultValue, {
|
||||||
string: x => {
|
string: x => {
|
||||||
const strValue = x.trim().toLowerCase();
|
const strValue = x.trim().toLowerCase();
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue