aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/misc.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/misc.ts')
-rw-r--r--server/helpers/custom-validators/misc.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index cf32201c4..61c03f0c9 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -45,6 +45,10 @@ function isBooleanValid (value: any) {
45 return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) 45 return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value))
46} 46}
47 47
48function isIntOrNull (value: any) {
49 return value === null || validator.isInt('' + value)
50}
51
48function toIntOrNull (value: string) { 52function toIntOrNull (value: string) {
49 const v = toValueOrNull(value) 53 const v = toValueOrNull(value)
50 54
@@ -116,6 +120,7 @@ export {
116 isArrayOf, 120 isArrayOf,
117 isNotEmptyIntArray, 121 isNotEmptyIntArray,
118 isArray, 122 isArray,
123 isIntOrNull,
119 isIdValid, 124 isIdValid,
120 isSafePath, 125 isSafePath,
121 isUUIDValid, 126 isUUIDValid,