yaml1.5.1 • Public • Published
yaml fully supports reading and writing comments and blank lines in YAML documents.
The library is released under the ISC open source license, and the code is available on GitHub. It runs on Node.js 6 and later with no external dependencies, and in browsers from IE 11 upwards (Note:
@babel/runtime is used only by the
"browser" entry point).
For more information, see the project's documentation site: eemeli.org/yaml
npm install yaml# oryarn add yaml
yaml 0.x and 1.x are rather different implementations. For the earlier
yaml, see tj/js-yaml.
The API provided by
yaml has three layers, depending on how deep you need to go: Parse & Stringify, Documents, and the CST Parser. The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent AST, and the third is the closest to YAML source, making it fast, raw, and crude.
// orconst YAML =
Parse & Stringify
YAML.createNode(value, wrapScalars, tag): Node
YAML.parseAllDocuments(str, options): YAML.Document
YAML.parseDocument(str, options): YAML.Document
YAML// '3.14159\n'YAML// `- true// - false// - maybe// - null// `YAML// `number: 3// plain: string// block: >// two//// lines// `
Browser testing provided by: