Gathering detailed insights and metrics for yaml
Gathering detailed insights and metrics for yaml
Gathering detailed insights and metrics for yaml
Gathering detailed insights and metrics for yaml
npm install yaml
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.5
Supply Chain
100
Quality
81.7
Maintenance
100
Vulnerability
100
License
TypeScript (98.67%)
JavaScript (1.33%)
Total Downloads
6,937,315,544
Last Day
11,908,981
Last Week
63,326,233
Last Month
271,409,285
Last Year
2,593,451,919
ISC License
1,407 Stars
1,512 Commits
120 Forks
13 Watchers
5 Branches
27 Contributors
Updated on Mar 26, 2025
Minified
Minified + Gzipped
Latest Version
2.7.0
Package Id
yaml@2.7.0
Unpacked Size
665.16 kB
Size
108.74 kB
File Count
233
NPM Version
10.9.2
Node Version
23.4.0
Published on
Dec 31, 2024
Cumulative downloads
Total Downloads
Last Day
1.2%
11,908,981
Compared to previous day
Last Week
2.1%
63,326,233
Compared to previous week
Last Month
8.1%
271,409,285
Compared to previous month
Last Year
36.6%
2,593,451,919
Compared to previous year
21
yaml
is a definitive library for YAML, the human friendly data serialization standard.
This library:
The library is released under the ISC open source license, and the code is available on GitHub. It has no external dependencies and runs on Node.js as well as modern browsers.
For the purposes of versioning, any changes that break any of the documented endpoints or APIs will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).
The minimum supported TypeScript version of the included typings is 3.9;
for use in earlier versions you may need to set skipLibCheck: true
in your config.
This requirement may be updated between minor versions of the library.
For more information, see the project's documentation site: eemeli.org/yaml
To install:
1npm install yaml
Note: These docs are for yaml@2
. For v1, see the v1.10.0 tag for the source and eemeli.org/yaml/v1 for the documentation.
The development and maintenance of this library is sponsored by:
The API provided by yaml
has three layers, depending on how deep you need to go: Parse & Stringify, Documents, and the underlying Lexer/Parser/Composer.
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 lets you get progressively closer to YAML source, if that's your thing.
A command-line tool is also included.
1import { parse, stringify } from 'yaml'
1import { 2 Document, 3 isDocument, 4 parseAllDocuments, 5 parseDocument 6} from 'yaml'
Document
isDocument(foo): boolean
parseAllDocuments(str, options?): Document[]
parseDocument(str, options?): Document
1import { 2 isAlias, isCollection, isMap, isNode, 3 isPair, isScalar, isSeq, Scalar, 4 visit, visitAsync, YAMLMap, YAMLSeq 5} from 'yaml'
isAlias(foo): boolean
isCollection(foo): boolean
isMap(foo): boolean
isNode(foo): boolean
isPair(foo): boolean
isScalar(foo): boolean
isSeq(foo): boolean
new Scalar(value)
new YAMLMap()
new YAMLSeq()
doc.createAlias(node, name?): Alias
doc.createNode(value, options?): Node
doc.createPair(key, value): Pair
visit(node, visitor)
visitAsync(node, visitor)
1import { Composer, Lexer, Parser } from 'yaml'
1# file.yml 2YAML: 3 - A human-readable data serialization language 4 - https://en.wikipedia.org/wiki/YAML 5yaml: 6 - A complete JavaScript implementation 7 - https://www.npmjs.com/package/yaml
1import fs from 'fs' 2import YAML from 'yaml' 3 4YAML.parse('3.14159') 5// 3.14159 6 7YAML.parse('[ true, false, maybe, null ]\n') 8// [ true, false, 'maybe', null ] 9 10const file = fs.readFileSync('./file.yml', 'utf8') 11YAML.parse(file) 12// { YAML: 13// [ 'A human-readable data serialization language', 14// 'https://en.wikipedia.org/wiki/YAML' ], 15// yaml: 16// [ 'A complete JavaScript implementation', 17// 'https://www.npmjs.com/package/yaml' ] }
1import YAML from 'yaml' 2 3YAML.stringify(3.14159) 4// '3.14159\n' 5 6YAML.stringify([true, false, 'maybe', null]) 7// `- true 8// - false 9// - maybe 10// - null 11// ` 12 13YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' }) 14// `number: 3 15// plain: string 16// block: | 17// two 18// lines 19// `
Browser testing provided by:
7.5/10
Summary
Uncaught Exception in yaml
Affected Versions
>= 2.0.0-5, < 2.2.2
Patched Versions
2.2.2
Reason
12 commit(s) and 9 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
project is fuzzed
Details
Reason
SAST tool is run on all commits
Details
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 2/22 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-03-24
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More