Make NaN undefined
This commit is contained in:
parent
30bf3dde6c
commit
0f729dee1b
|
@ -17,7 +17,12 @@ export const convertCamel = str => {
|
|||
|
||||
export const pipe = (arg, funcs) => flow(funcs)(arg)
|
||||
|
||||
export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)
|
||||
export const capitalise = s => {
|
||||
if (!s) {
|
||||
return s
|
||||
}
|
||||
return s.substring(0, 1).toUpperCase() + s.substring(1)
|
||||
}
|
||||
|
||||
export const lowercase = s => s.substring(0, 1).toLowerCase() + s.substring(1)
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@ export const createValidationStore = () => {
|
|||
let propertyValidator
|
||||
switch (type) {
|
||||
case "number":
|
||||
propertyValidator = number()
|
||||
propertyValidator = number().transform(value =>
|
||||
isNaN(value) ? undefined : value
|
||||
)
|
||||
break
|
||||
case "email":
|
||||
propertyValidator = string().email()
|
||||
|
|
Loading…
Reference in New Issue