fix: stops negative numbers being interpreted as strings (#511)
Co-authored-by: Balloonpopper <balloonpopper@git.com>
This commit is contained in:
@@ -43,9 +43,9 @@ func get_typed_value(value: String, type_hint = []):
|
|||||||
var regex_bool = RegEx.new()
|
var regex_bool = RegEx.new()
|
||||||
regex_bool.compile("^true|false$")
|
regex_bool.compile("^true|false$")
|
||||||
var regex_float = RegEx.new()
|
var regex_float = RegEx.new()
|
||||||
regex_float.compile("^[0-9]+\\.[0-9]+$")
|
regex_float.compile("^-?[0-9]+\\.[0-9]+$")
|
||||||
var regex_int = RegEx.new()
|
var regex_int = RegEx.new()
|
||||||
regex_int.compile("^[0-9]+$")
|
regex_int.compile("^-?[0-9]+$")
|
||||||
|
|
||||||
if regex_float.search(value):
|
if regex_float.search(value):
|
||||||
return float(value)
|
return float(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user