Skip to main content
Home

@std/yaml@1.0.10

Parsing and serializing of YAML files

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
88%
Published
3 months ago (1.0.10)

parse and stringify for handling YAML encoded data.

Ported from js-yaml v3.13.1.

Use parseAll for 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:

Unsupported YAML 1.1 features include:

  • Yes, No, On, Off literals for bool type
  • Sexagesimal numbers (e.g. 3:25:45)
import { parse, stringify } from "@std/yaml";
import { assertEquals } from "@std/assert";

const data = parse(`
foo: bar
baz:
  - qux
  - quux
`);
assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });

const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });
assertEquals(yaml, `foo: bar
baz:
  - qux
  - quux
`);

Limitations

  • binary type is currently not stable.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/yaml

Import symbol

import * as yaml from "@std/yaml";
or

Import directly with a jsr specifier

import * as yaml from "jsr:@std/yaml";

Add Package

pnpm i jsr:@std/yaml
or (using pnpm 10.8 or older)
pnpm dlx jsr add @std/yaml

Import symbol

import * as yaml from "@std/yaml";

Add Package

yarn add jsr:@std/yaml
or (using Yarn 4.8 or older)
yarn dlx jsr add @std/yaml

Import symbol

import * as yaml from "@std/yaml";

Add Package

vlt install jsr:@std/yaml

Import symbol

import * as yaml from "@std/yaml";

Add Package

npx jsr add @std/yaml

Import symbol

import * as yaml from "@std/yaml";

Add Package

bunx jsr add @std/yaml

Import symbol

import * as yaml from "@std/yaml";