Make NaN undefined
This commit is contained in:
parent
777e8f91f1
commit
2bfeb85013
|
@ -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