mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 07:23:51 +01:00
15 lines
389 B
Rust
15 lines
389 B
Rust
use deno_core::error::AnyError;
|
|
use deno_core::op2;
|
|
|
|
#[op2]
|
|
#[serde] pub fn op_yaml_parse(#[string] text: String) -> Result<serde_json::Value, AnyError> {
|
|
let value = serde_yaml::from_str(&text)?;
|
|
Ok(value)
|
|
}
|
|
|
|
#[op2]
|
|
#[string] pub fn op_yaml_stringify(#[serde] value: serde_json::Value) -> Result<String, AnyError> {
|
|
let value = serde_yaml::to_string(&value)?;
|
|
Ok(value)
|
|
}
|