Skip to main content

@std/yaml@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score52%
Published2 years ago (0.215.0)

parse and stringify for handling YAML encoded data.

Ported from js-yaml v3.13.1.

If your YAML contains multiple documents in it, you can use parseAll for handling it.

To handle regexp, and undefined types, use EXTENDED_SCHEMA. You can also use custom types by extending schemas.

:warning: Limitations

  • binary type is currently not stable.

For further examples see https://github.com/nodeca/js-yaml/tree/master/examples.

Examples

Example 1

import {
  parse,
  stringify,
} from "@std/yaml";

const data = parse(`
foo: bar
baz:
  - qux
  - quux
`);
console.log(data);
// => { foo: "bar", baz: [ "qux", "quux" ] }

const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });
console.log(yaml);
// =>
// foo: bar
// baz:
//   - qux
//   - quux

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";