Remove duplicate code for parsing numbers.
This commit is contained in:
parent
15d3f45bae
commit
b1075aa2ec
6 changed files with 181 additions and 35 deletions
server/shared/validation
|
@ -1,4 +1,4 @@
|
|||
import { parseInteger } from "../utils/strings";
|
||||
import { parseToInteger } from "../utils/numbers";
|
||||
import {
|
||||
isBoolean,
|
||||
isNumber,
|
||||
|
@ -67,7 +67,7 @@ function isValidBoolean(value: unknown): boolean {
|
|||
|
||||
function isValidNumber(constraint: Constraint, value: unknown): boolean {
|
||||
if (isString(value)) {
|
||||
value = parseInteger(value);
|
||||
value = parseToInteger(value);
|
||||
}
|
||||
|
||||
if (!isNumber(value)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue