Modules@robinpath/yaml

@robinpath/yaml

0.1.0Public

Parse, stringify, and manipulate YAML data

@robinpath/yaml

Parse, stringify, and manipulate YAML data

Category Functions Auth License

Why use this module?

The yaml module lets you:

  • Parse a YAML string into a JavaScript object, array, or value
  • Convert a JavaScript value into a YAML string
  • Read and parse a YAML file from disk
  • Write a value as YAML to a file on disk
  • Parse a multi-document YAML string into an array of documents

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/yaml

Quick Start

No credentials needed — start using it right away:

yaml.stringify $data

Available Functions

FunctionDescription
yaml.parseParse a YAML string into a JavaScript object, array, or value
yaml.stringifyConvert a JavaScript value into a YAML string
yaml.parseFileRead and parse a YAML file from disk
yaml.writeFileWrite a value as YAML to a file on disk
yaml.parseAllParse a multi-document YAML string into an array of documents
yaml.isValidCheck whether a string is valid YAML
yaml.getParse YAML and retrieve a nested value by dot-path
yaml.toJSONConvert a YAML string to a JSON string
yaml.fromJSONConvert a JSON string to a YAML string

Examples

Convert a JavaScript value into a YAML string

yaml.stringify $data

Read and parse a YAML file from disk

yaml.parseFile "config.yaml"

Write a value as YAML to a file on disk

yaml.writeFile "output.yaml" $data

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/yaml";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  yaml.stringify $data
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/yaml
Version0.1.0
LicenseMIT
Unpacked Size4.3 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities