{"id":15734026,"url":"https://github.com/eemeli/yaml-types","last_synced_at":"2025-05-07T08:25:03.078Z","repository":{"id":153050624,"uuid":"627962705","full_name":"eemeli/yaml-types","owner":"eemeli","description":"Useful JavaScript types for YAML","archived":false,"fork":false,"pushed_at":"2024-07-07T13:29:33.000Z","size":190,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T08:07:18.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/yaml-types","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":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"eemeli","tidelift":"npm/yaml"}},"created_at":"2023-04-14T15:30:12.000Z","updated_at":"2025-02-04T05:43:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"26492903-0f67-4c42-be40-563ecd5f263e","html_url":"https://github.com/eemeli/yaml-types","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.1785714285714286,"last_synced_commit":"6e68239273b12ebbd1392a535a1db8c4e514ee48"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eemeli%2Fyaml-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eemeli","download_url":"https://codeload.github.com/eemeli/yaml-types/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252840646,"owners_count":21812353,"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":[],"created_at":"2024-10-04T01:00:49.345Z","updated_at":"2025-05-07T08:25:03.030Z","avatar_url":"https://github.com/eemeli.png","language":"TypeScript","funding_links":["https://github.com/sponsors/eemeli","https://tidelift.com/funding/github/npm/yaml"],"categories":[],"sub_categories":[],"readme":"# yaml-types\n\nAdditional useful types for [`yaml`](https://github.com/eemeli/yaml).\n\n## Installation and Usage\n\n```\nnpm install yaml yaml-types\n```\n\nEach type (a.k.a. \"tag\") is available as a named export of `'yaml-types'`.\nThese may then be used as [custom tags](https://eemeli.org/yaml/#writing-custom-tags):\n\n```js\nimport { parse } from 'yaml'\nimport { regexp } from 'yaml-types'\n\nconst re = parse('!re /fo./g', { customTags: [regexp] })\n'foxbarfoo'.match(re) // [ 'fox', 'foo' ]\n```\n\n## Available Types\n\n- `bigint` (`!bigint`) - JavaScript [BigInt] values.\n  Note: in order to use this effectively,\n  a function must be provided as `customTags` in order to prepend the `bigint` tag,\n  or else the built-in `!!int` tags will take priority.\n  See [bigint.test.ts](./src/bigint.test.ts) for examples.\n- `binary` (`!!binary`) - JavaScript [Uint8Array], one of the YAML 1.1 tags\n- `classTag` (`!class`) - JavaScript [Class] values\n- `error` (`!error`) - JavaScript [Error] objects\n- `functionTag` (`!function`) - JavaScript [Function] values\n  (will also be used to stringify Class values,\n  unless the `classTag` tag is loaded ahead of `functionTag`)\n- `nullobject` (`!nullobject`) - Object with a `null` prototype\n- `omap` (`!!omap`) - JavaScript [Map], one of the YAML 1.1 tags\n- `pairs` (`!!pairs`) - Ordered sequence of key-value [pairs], one of the YAML 1.1 tags\n- `regexp` (`!re`) - [RegExp] values,\n  using their default `/foo/flags` string representation.\n- `set` (`!!set`) - JavaScript [Set], one of the YAML 1.1 tags\n- `sharedSymbol` (`!symbol/shared`) - [Shared Symbols],\n  i.e. ones created with `Symbol.for()`\n- `symbol` (`!symbol`) - [Unique Symbols]\n- `timestamp` (`!!timestamp`) - JavaScript [Date], one of the YAML 1.1 tags\n\nThe function and class values created by parsing `!function` and\n`!class` tags will not actually replicate running code, but\nrather no-op function/class values with matching name and\n`toString` properties.\n\n[BigInt]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt\n[Class]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes\n[Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date\n[Error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n[Function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions\n[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions\n[Set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set\n[Shared Symbols]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#shared_symbols_in_the_global_symbol_registry\n[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n[Unique Symbols]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol\n[pairs]: https://yaml.org/type/pairs.html\n\n## Customising Tag Names\n\nTo use one of the types with a different tag identifier, set its `tag` value accordingly.\nFor example, to extend the default tag namespace with `!!js/symbol`\ninstead of using a local `!symbol` tag for Symbol values:\n\n```js\nimport { stringify } from 'yaml'\nimport { symbol } from 'yaml-types'\n\nconst mysymbol = { ...symbol, tag: 'tag:yaml.org,2002:js/symbol' }\nstringify(Symbol('foo'), { customTags: [mysymbol] })\n```\n\n```yaml\n!!js/symbol foo\n```\n\nTo use a named tag handle like `!js!symbol`, a few more steps are required:\n\n```js\nimport { Document } from 'yaml'\nimport { symbol } from 'yaml-types'\n\nconst mysymbol = { ...symbol, tag: 'tag:js:symbol' }\nconst doc = new Document(Symbol('foo'), { customTags: [mysymbol] })\ndoc.directives.tags['!js!'] = 'tag:js:'\ndoc.toString()\n```\n\n```yaml\n%TAG !js! tag:js:\n---\n!js!symbol foo\n```\n\n## Contributing\n\nAdditions to this library are very welcome!\nMany data types are useful beyond any single project,\nand while the core `yaml` library is mostly limited to the YAML spec,\nno such restriction applies here.\n\nThe source code is written in [TypeScript], and the tests use [Node-Tap].\nWhen submitting a PR for a new type, tests and documentation are required,\nas well as satisfying [Prettier].\n\n[TypeScript]: https://www.typescriptlang.org/\n[Node-Tap]: https://node-tap.org/\n[Prettier]: https://prettier.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feemeli%2Fyaml-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feemeli%2Fyaml-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feemeli%2Fyaml-types/lists"}