feat: toString method

This commit is contained in:
Artemy 2022-08-14 23:33:49 +03:00
parent 66ba25c8b6
commit d5d2e81ebb

View file

@ -191,6 +191,13 @@ impl Interpreter {
self.error("Unsupported data type for the `arr` argument, must be an array"); self.error("Unsupported data type for the `arr` argument, must be an array");
} }
}, },
"toString" => {
return serde_json::Value::String(
serde_json::to_string_pretty(&self.eval_node(value))
.expect("Some error"),
)
}
"obj" => match value { "obj" => match value {
Value::Object(value) => { Value::Object(value) => {
return self.calc_obj(value); return self.calc_obj(value);