{"id":13526934,"url":"https://github.com/eemeli/yaml","last_synced_at":"2025-05-14T22:02:21.694Z","repository":{"id":37678101,"uuid":"119439276","full_name":"eemeli/yaml","owner":"eemeli","description":"YAML parser and stringifier for JavaScript","archived":false,"fork":false,"pushed_at":"2025-04-15T12:54:08.000Z","size":9021,"stargazers_count":1443,"open_issues_count":20,"forks_count":124,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-07T09:50:00.412Z","etag":null,"topics":["yaml","yaml-editor","yaml-parser"],"latest_commit_sha":null,"homepage":"https://eemeli.org/yaml","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eemeli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"eemeli","tidelift":"npm/yaml"}},"created_at":"2018-01-29T20:45:06.000Z","updated_at":"2025-05-07T06:33:53.000Z","dependencies_parsed_at":"2024-02-15T12:31:37.132Z","dependency_job_id":"c51b951b-7829-46b4-9a41-59f98ca96c1f","html_url":"https://github.com/eemeli/yaml","commit_stats":{"total_commits":1448,"total_committers":28,"mean_commits":"51.714285714285715","dds":0.03453038674033149,"last_synced_commit":"715e8eddf2611363cb16fa34fe04dbbc3280993e"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eemeli","download_url":"https://codeload.github.com/eemeli/yaml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252864653,"owners_count":21816273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["yaml","yaml-editor","yaml-parser"],"created_at":"2024-08-01T06:01:37.953Z","updated_at":"2025-05-14T22:02:21.667Z","avatar_url":"https://github.com/eemeli.png","language":"TypeScript","readme":"# YAML \u003ca href=\"https://www.npmjs.com/package/yaml\"\u003e\u003cimg align=\"right\" src=\"https://badge.fury.io/js/yaml.svg\" title=\"npm package\" /\u003e\u003c/a\u003e\n\n`yaml` is a definitive library for [YAML](https://yaml.org/), the human friendly data serialization standard.\nThis library:\n\n- Supports both YAML 1.1 and YAML 1.2 and all common data schemas,\n- Passes all of the [yaml-test-suite](https://github.com/yaml/yaml-test-suite) tests,\n- Can accept any string as input without throwing, parsing as much YAML out of it as it can, and\n- Supports parsing, modifying, and writing YAML comments and blank lines.\n\nThe library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/).\nIt has no external dependencies and runs on Node.js as well as modern browsers.\n\nFor the purposes of versioning, any changes that break any of the documented endpoints or APIs will be considered semver-major breaking changes.\nUndocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).\n\nThe minimum supported TypeScript version of the included typings is 3.9;\nfor use in earlier versions you may need to set `skipLibCheck: true` in your config.\nThis requirement may be updated between minor versions of the library.\n\nFor more information, see the project's documentation site: [**eemeli.org/yaml**](https://eemeli.org/yaml/)\n\nTo install:\n\n```sh\nnpm install yaml\n# or\ndeno add jsr:@eemeli/yaml\n```\n\n**Note:** These docs are for `yaml@2`. For v1, see the [v1.10.0 tag](https://github.com/eemeli/yaml/tree/v1.10.0) for the source and [eemeli.org/yaml/v1](https://eemeli.org/yaml/v1/) for the documentation.\n\nThe development and maintenance of this library is [sponsored](https://github.com/sponsors/eemeli) by:\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n  \u003ca href=\"https://www.scipress.io/\"\n    \u003e\u003cimg\n      width=\"150\"\n      align=\"top\"\n      src=\"https://eemeli.org/yaml/images/scipress.svg\"\n      alt=\"Scipress\"\n  /\u003e\u003c/a\u003e\n  \u0026nbsp; \u0026nbsp;\n  \u003ca href=\"https://manifest.build/\"\n    \u003e\u003cimg\n      width=\"150\"\n      align=\"top\"\n      src=\"https://eemeli.org/yaml/images/manifest.svg\"\n      alt=\"Manifest\"\n  /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## API Overview\n\nThe API provided by `yaml` has three layers, depending on how deep you need to go: [Parse \u0026 Stringify](https://eemeli.org/yaml/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the underlying [Lexer/Parser/Composer](https://eemeli.org/yaml/#parsing-yaml).\nThe 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](https://eemeli.org/yaml/#content-nodes), and the third lets you get progressively closer to YAML source, if that's your thing.\n\nA [command-line tool](https://eemeli.org/yaml/#command-line-tool) is also included.\n\n### Parse \u0026 Stringify\n\n```js\nimport { parse, stringify } from 'yaml'\n```\n\n- [`parse(str, reviver?, options?): value`](https://eemeli.org/yaml/#yaml-parse)\n- [`stringify(value, replacer?, options?): string`](https://eemeli.org/yaml/#yaml-stringify)\n\n### Documents\n\n\u003c!-- prettier-ignore --\u003e\n```js\nimport {\n  Document,\n  isDocument,\n  parseAllDocuments,\n  parseDocument\n} from 'yaml'\n```\n\n- [`Document`](https://eemeli.org/yaml/#documents)\n  - [`constructor(value, replacer?, options?)`](https://eemeli.org/yaml/#creating-documents)\n  - [`#contents`](https://eemeli.org/yaml/#content-nodes)\n  - [`#directives`](https://eemeli.org/yaml/#stream-directives)\n  - [`#errors`](https://eemeli.org/yaml/#errors)\n  - [`#warnings`](https://eemeli.org/yaml/#errors)\n- [`isDocument(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`parseAllDocuments(str, options?): Document[]`](https://eemeli.org/yaml/#parsing-documents)\n- [`parseDocument(str, options?): Document`](https://eemeli.org/yaml/#parsing-documents)\n\n### Content Nodes\n\n\u003c!-- prettier-ignore --\u003e\n```js\nimport {\n  isAlias, isCollection, isMap, isNode,\n  isPair, isScalar, isSeq, Scalar,\n  visit, visitAsync, YAMLMap, YAMLSeq\n} from 'yaml'\n```\n\n- [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isNode(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isPair(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isScalar(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`isSeq(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)\n- [`new Scalar(value)`](https://eemeli.org/yaml/#scalar-values)\n- [`new YAMLMap()`](https://eemeli.org/yaml/#collections)\n- [`new YAMLSeq()`](https://eemeli.org/yaml/#collections)\n- [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#creating-nodes)\n- [`doc.createNode(value, options?): Node`](https://eemeli.org/yaml/#creating-nodes)\n- [`doc.createPair(key, value): Pair`](https://eemeli.org/yaml/#creating-nodes)\n- [`visit(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes)\n- [`visitAsync(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes)\n\n### Parsing YAML\n\n```js\nimport { Composer, Lexer, Parser } from 'yaml'\n```\n\n- [`new Lexer().lex(src)`](https://eemeli.org/yaml/#lexer)\n- [`new Parser(onNewLine?).parse(src)`](https://eemeli.org/yaml/#parser)\n- [`new Composer(options?).compose(tokens)`](https://eemeli.org/yaml/#composer)\n\n## YAML.parse\n\n```yaml\n# file.yml\nYAML:\n  - A human-readable data serialization language\n  - https://en.wikipedia.org/wiki/YAML\nyaml:\n  - A complete JavaScript implementation\n  - https://www.npmjs.com/package/yaml\n```\n\n```js\nimport fs from 'fs'\nimport YAML from 'yaml'\n\nYAML.parse('3.14159')\n// 3.14159\n\nYAML.parse('[ true, false, maybe, null ]\\n')\n// [ true, false, 'maybe', null ]\n\nconst file = fs.readFileSync('./file.yml', 'utf8')\nYAML.parse(file)\n// { YAML:\n//   [ 'A human-readable data serialization language',\n//     'https://en.wikipedia.org/wiki/YAML' ],\n//   yaml:\n//   [ 'A complete JavaScript implementation',\n//     'https://www.npmjs.com/package/yaml' ] }\n```\n\n## YAML.stringify\n\n```js\nimport YAML from 'yaml'\n\nYAML.stringify(3.14159)\n// '3.14159\\n'\n\nYAML.stringify([true, false, 'maybe', null])\n// `- true\n// - false\n// - maybe\n// - null\n// `\n\nYAML.stringify({ number: 3, plain: 'string', block: 'two\\nlines\\n' })\n// `number: 3\n// plain: string\n// block: |\n//   two\n//   lines\n// `\n```\n\n---\n\nBrowser testing provided by:\n\n\u003ca href=\"https://www.browserstack.com/open-source\"\u003e\n\u003cimg width=200 src=\"https://eemeli.org/yaml/images/browserstack.svg\" alt=\"BrowserStack\" /\u003e\n\u003c/a\u003e\n","funding_links":["https://github.com/sponsors/eemeli","https://tidelift.com/funding/github/npm/yaml"],"categories":["TypeScript","Repository","yaml","Utilities"],"sub_categories":["Parsing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feemeli%2Fyaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feemeli%2Fyaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feemeli%2Fyaml/lists"}