@toa.io/yaml
TypeScript icon, indicating that this package has built-in type declarations

0.24.0-alpha.0 • Public • Published

Toa Yaml

Wrapper for js-yaml.

async load(path: string): object

sync(path: string): object

Read an object from a YAML flie.

all(path: string): object[]

Read an array from a multi-document YAML file.

async save(object: object, path: strgin): void

Write an object to a YAML file.

parse(input: string): object

Parse a YAML document.

split(input: string): object[]

Parse a multi-document YAML.

dump(input: object): string

Serialize an object to a YAML document.

YAML Keywords (non-standard)

<assign

Load an object from the specified file and assign its properties to the current node recursively ( deep merge).

<assign: <path>[#fragment]
  • path Absolute or relative path to a file, or a glob pattern.
  • fragment URL path to a source object (optional)

When using a pattern, all matched files will be processed sequentially.

Example

# a.yaml
foo:
  bar: 1
# b.yaml
qux: 'hello'
foo:
  baz: 2
# c.yaml
<assign: '*.yaml'

Environment variables

YAML documents can contain environment variable placeholders.

foo: ${{ BAR }}

Readme

Keywords

none

Package Sidebar

Install

npm i @toa.io/yaml

Homepage

toa.io

Weekly Downloads

1,195

Version

0.24.0-alpha.0

License

MIT

Unpacked Size

15.5 kB

Total Files

41

Last publish

Collaborators

  • agurtovoi