Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 2, 2024 via pnpm

yaml 1.10.2

JavaScript parser and stringifier for YAML
Package summary
Share
0
issues
1
license
1
ISC
Package created
15 Apr 2011
Version published
13 Mar 2021
Maintainers
1
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
yaml@1.10.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of yaml 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does yaml do?

YAML is a comprehensive JavaScript library that provides a definitive solution for YAML, a human-friendly data serialization standard. Amongst its abilities, YAML supports both YAML 1.1 and YAML 1.2, passes all yaml-test-suite tests, can take any string as input without crashing by parsing as much YAML out of it as it can, and allows for parsing, adjusting, and writing YAML comments and blank lines. The library comes with no external dependencies and can smoothly run on Node.js as well as modern browsers.

How do you use yaml?

The use of YAML is straightforward and simply requires installation followed by importing the necessary methods or the whole library. Once installed using npm install yaml, the library can be used in your JavaScript project as follows:

To import methods parse and stringify:

import { parse, stringify } from 'yaml'

Or to import the entire library:

import YAML from 'yaml'
// or
const YAML = require('yaml')

Here are some usage examples:

Parsing YAML:

import fs from 'fs'
import YAML from 'yaml'

YAML.parse('3.14159')  // Output: 3.14159

YAML.parse('[ true, false, maybe, null ]\n')  // Output: [ true, false, 'maybe', null ]

const file = fs.readFileSync('./file.yml', 'utf8')
YAML.parse(file) 
// Output: 
// { YAML:
//   [ 'A human-readable data serialization language',
//     'https://en.wikipedia.org/wiki/YAML' ],
//   yaml:
//   [ 'A complete JavaScript implementation',
//     'https://www.npmjs.com/package/yaml' ] }

Stringifying YAML:

import YAML from 'yaml'

YAML.stringify(3.14159)  // Output: '3.14159\n'

YAML.stringify([true, false, 'maybe', null])
// Output: `- true
// - false
// - maybe
// - null
// `

YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' })
// Output: `number: 3
// plain: string
// block: |
//   two
//   lines
// `

Where are the yaml docs?

All of the comprehensive documentation for YAML including usage examples, API overviews, Document classes, Content Nodes, and Parsing YAML can be found on the project's documentation site, eemeli.org/yaml.