fix: normalize number during serialization

This commit is contained in:
Stefan
2025-06-02 14:19:37 +02:00
parent 40bba9be9e
commit 590f32d3de
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -56,7 +56,9 @@ impl From<Variable> for Value {
match value {
Variable::Null => Value::Null,
Variable::Bool(b) => Value::Bool(b),
Variable::Number(n) => Value::Number(Number::from_string_unchecked(n.to_string())),
Variable::Number(n) => {
Value::Number(Number::from_string_unchecked(n.normalize().to_string()))
}
Variable::String(s) => Value::String(s.to_string()),
Variable::Array(arr) => {
let vec = Rc::try_unwrap(arr)
+1 -1
View File
@@ -12,7 +12,7 @@ trait PrettyPrint {
impl PrettyPrint for Variable {
fn pretty_print(&self) -> String {
match &self {
Variable::Number(num) => format!("{}", num.to_string().yellow()),
Variable::Number(num) => format!("{}", num.normalize().to_string().yellow()),
Variable::String(str) => format!("{}", format!("'{}'", str).green()),
Variable::Bool(b) => format!("{}", b.to_string().yellow()),
Variable::Null => format!("{}", "null".bold()),