parse

import { parse } from "jsr:@ende/yaml";

function

function parse(content: string, options: ParseOptions = [UNSUPPORTED]): unknown

Parse and return a YAML string as a parsed YAML document object.

Note: This does not support functions. Untrusted data is safe to parse.

content: string

YAML string to parse.

options: ParseOptions = [UNSUPPORTED]

Parsing options.

Returns

Parsed document.

Example: Usage

import { parse } from "@ende/yaml/parse";
import { assertEquals } from "@ende/assert";

const data = parse(`
id: 1
name: Alice
`);

assertEquals(data, { id: 1, name: "Alice" });

Source