mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-25 12:34:45 -04:00
fix: rename parseOptionalInt to parseOptionalNumber
This allows us to handle the possible errors due to non-integer numbers with joi and return more precise error messages. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
151e12a8a7
commit
45df0e6edb
7 changed files with 27 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
@ -113,9 +113,9 @@ function transformLoglevelToInt(loglevel: Loglevel): number {
|
|||
}
|
||||
}
|
||||
|
||||
export function parseOptionalInt(value?: string): number | undefined {
|
||||
export function parseOptionalNumber(value?: string): number | undefined {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return parseInt(value);
|
||||
return Number(value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue