}
function toIntOrNull (value: string) {
- if (value === 'null') return null
+ const v = toValueOrNull(value)
+
+ if (v === null || v === undefined) return v
+ if (typeof v === 'number') return v
+
+ return validator.toInt('' + v)
+}
+
+function toBooleanOrNull (value: any) {
+ const v = toValueOrNull(value)
+
+ if (v === null || v === undefined) return v
+ if (typeof v === 'boolean') return v
- return validator.toInt(value)
+ return validator.toBoolean('' + v)
}
function toValueOrNull (value: string) {
isIdOrUUIDValid,
isDateValid,
toValueOrNull,
+ toBooleanOrNull,
isBooleanValid,
toIntOrNull,
toArray,