parse and stringify for handling YAML encoded data.
parse
stringify
Ported from js-yaml v3.13.1.
Use parseAll for parsing multiple documents in a single YAML string.
parseAll
This package generally supports YAML 1.2.x (latest) and some YAML 1.1 features that are commonly used in the wild.
Supported YAML 1.1 features include:
<<
Unsupported YAML 1.1 features include:
3:25:45
import { parse, stringify } from "@std/yaml";import { assertEquals } from "@std/assert";const data = parse(`foo: barbaz: - qux - quux`);assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });assertEquals(yaml, `foo: barbaz: - qux - quux`); Copy
import { parse, stringify } from "@std/yaml";import { assertEquals } from "@std/assert";const data = parse(`foo: barbaz: - qux - quux`);assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });assertEquals(yaml, `foo: barbaz: - qux - quux`);
binary
parseandstringifyfor handling YAML encoded data.Ported from js-yaml v3.13.1.
Use
parseAllfor parsing multiple documents in a single YAML string.This package generally supports YAML 1.2.x (latest) and some YAML 1.1 features that are commonly used in the wild.
Supported YAML 1.1 features include:
<<symbol)Unsupported YAML 1.1 features include:
3:25:45)Limitations
binarytype is currently not stable.