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
YAML parser and stringifier for JavaScript
npm install yaml
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.7
Supply Chain
100
Quality
87.7
Maintenance
100
Vulnerability
100
License
Updated on 04 Dec 2024
Minified
Minified + Gzipped
TypeScript (99.07%)
JavaScript (0.93%)
Cumulative downloads
Total Downloads
Last day
7.9%
Compared to previous day
Last week
-8.3%
Compared to previous week
Last month
10.6%
Compared to previous month
Last year
38.7%
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' 2// or 3import YAML from 'yaml' 4// or 5const YAML = require('yaml')
Document
isDocument(foo): boolean
parseAllDocuments(str, options?): Document[]
parseDocument(str, options?): Document
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)
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:
Stable Version
1
7.5/10
Summary
Uncaught Exception in yaml
Affected Versions
>= 2.0.0-5, < 2.2.2
Patched Versions
2.2.2
Reason
security policy file detected
Details
Reason
17 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
project is fuzzed
Details
Reason
SAST tool is run on all commits
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 4/30 approved changesets -- score normalized to 1
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 2024-12-02
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