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)

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

Classes

c
Type(
tag: string,
options?: TypeOptions
)
No documentation available
  • construct: (data?: Any) => Any
    No documentation available
  • defaultStyle: StyleVariant
    No documentation available
  • No documentation available
  • kind: KindType | null
    No documentation available
  • loadKind: KindType
    No documentation available
  • predicate: (data: Record<string, unknown>) => boolean
    No documentation available
  • represent: RepresentFn | ArrayObject<RepresentFn>
    No documentation available
  • resolve: (data?: Any) => boolean
    No documentation available
  • styleAliases: ArrayObject
    No documentation available
  • tag: string
    No documentation available

Functions

f
parse(
content: string,
options?: ParseOptions
): unknown

Parses content as single YAML document.

f
parseAll(
content: string,
iterator?: CbFunction | ParseOptions,
options?: ParseOptions
): unknown
2 overloads

Same as parse(), but understands multi-document sources. Applies iterator to each document if specified, or returns array of documents.

f
stringify(
obj: Record<string, unknown>,
options?: DumpOptions
): string

Serializes object as a YAML document.

Type Aliases

T
DumpOptions = DumperStateOptions
No documentation available
T
KindType = "sequence" | "scalar" | "mapping"
No documentation available
T
ParseOptions = LoaderStateOptions
No documentation available
T
RepresentFn = (
data: Any,
style?: StyleVariant
) => Any
No documentation available
T
StyleVariant = "lowercase" | "uppercase" | "camelcase" | "decimal"
No documentation available

Variables

v
CORE_SCHEMA: Schema
No documentation available
v
No documentation available
v

Extends JS-YAML default schema with additional JavaScript types It is not described in the YAML specification. Functions are no longer supported for security reasons.

v
No documentation available
v
JSON_SCHEMA: Schema
No documentation available

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 mod from "@std/yaml";
or

Import directly with a jsr specifier

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