2
0

🐛 (setVariable) Properly parse phone number variables

This commit is contained in:
Baptiste Arnaud
2023-04-06 17:12:56 +02:00
parent 7af8e8af30
commit 44975f9742

View File

@@ -6,9 +6,11 @@ export const parseGuessedValueType = (
if (value === null) return null
if (value === undefined) return undefined
if (typeof value !== 'string') return value
const isNumberStartingWithZero =
const isStartingWithZero =
value.startsWith('0') && !value.startsWith('0.') && value.length > 1
if (typeof value === 'string' && isNumberStartingWithZero) return value
if (typeof value === 'string' && isStartingWithZero) return value
const isStartingWithPlus = value.startsWith('+')
if (typeof value === 'string' && isStartingWithPlus) return value
if (typeof value === 'number') return value
if (value === 'true') return true
if (value === 'false') return false