{"_id":"yaml-types","_rev":"4063002","name":"yaml-types","description":"Useful JavaScript types for YAML","dist-tags":{"latest":"0.4.0"},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"time":{"modified":"2025-09-24T04:25:42.000Z","created":"2023-04-14T16:50:42.433Z","0.4.0":"2024-07-07T13:29:21.178Z","0.3.0":"2023-05-31T06:22:30.027Z","0.2.0":"2023-05-23T11:40:55.040Z","0.1.0":"2023-04-14T16:50:42.433Z"},"users":{},"author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-types.git"},"versions":{"0.4.0":{"name":"yaml-types","version":"0.4.0","license":"ISC","author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-types.git"},"description":"Useful JavaScript types for YAML","keywords":["YAML","schema","tags"],"homepage":"https://eemeli.org/yaml/","type":"commonjs","exports":{".":"./dist/index.js","./package.json":"./package.json"},"scripts":{"build":"tsc","clean":"git clean -fdxe node_modules","prettier":"prettier --write .","prepublishOnly":"npm run clean && npm run test","prestart":"tsc","start":"node -i -e 'YAML=require(\"yaml\");YT=require(\"./dist/index.js\")'","pretest":"tsc","test":"tap"},"prettier":{"arrowParens":"avoid","semi":false,"singleQuote":true,"trailingComma":"none"},"tap":{"exclude":[],"include":["dist/*.test.js"]},"engines":{"node":">= 16","npm":">= 7"},"devDependencies":{"@types/tap":"^15.0.8","prettier":"^3.3.2","tap":"^19.2.5","typescript":"^5.0.4","yaml":"^2.3.0"},"peerDependencies":{"yaml":"^2.3.0"},"_id":"yaml-types@0.4.0","gitHead":"6e68239273b12ebbd1392a535a1db8c4e514ee48","bugs":{"url":"https://github.com/eemeli/yaml-types/issues"},"_nodeVersion":"22.3.0","_npmVersion":"10.8.1","dist":{"shasum":"e0cab9fb563cbf6f5fc0a40dd3b8cc7bfa06365e","size":6887,"noattachment":false,"key":"/yaml-types/-/yaml-types-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/yaml-types/download/yaml-types-0.4.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-types_0.4.0_1720358960964_0.7460688218682274"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-07-07T13:29:21.178Z","publish_time":1720358961178,"_source_registry_name":"default","_cnpm_publish_time":1720358961178},"0.3.0":{"name":"yaml-types","version":"0.3.0","license":"ISC","author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-types.git"},"description":"Useful JavaScript types for YAML","keywords":["YAML","schema","tags"],"homepage":"https://eemeli.org/yaml/","type":"commonjs","exports":{".":"./dist/index.js","./package.json":"./package.json"},"scripts":{"build":"tsc","clean":"git clean -fdxe node_modules","prettier":"prettier --write .","prepublishOnly":"npm run clean && npm run test","prestart":"tsc","start":"node -i -e 'YAML=require(\"yaml\");YT=require(\"./dist/index.js\")'","pretest":"tsc","test":"tap"},"prettier":{"arrowParens":"avoid","semi":false,"singleQuote":true,"trailingComma":"none"},"tap":{"test-regex":"\\.test\\.js"},"engines":{"node":">= 16","npm":">= 7"},"devDependencies":{"@types/tap":"^15.0.8","prettier":"^2.8.7","tap":"^16.3.4","typescript":"^5.0.4","yaml":"^2.3.0"},"peerDependencies":{"yaml":"^2.3.0"},"gitHead":"7fc6300e5b40d4c332d4455c19dbabb0534edd23","bugs":{"url":"https://github.com/eemeli/yaml-types/issues"},"_id":"yaml-types@0.3.0","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"shasum":"b077f34496e12dc709d97f2c3bad3fff11089680","size":6379,"noattachment":false,"key":"/yaml-types/-/yaml-types-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/yaml-types/download/yaml-types-0.3.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-types_0.3.0_1685514149887_0.701307514642693"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-31T06:22:30.027Z","publish_time":1685514150027,"_source_registry_name":"default","_cnpm_publish_time":1685514150027},"0.2.0":{"name":"yaml-types","version":"0.2.0","license":"ISC","author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-types.git"},"description":"Useful JavaScript types for YAML","keywords":["YAML","schema","tags"],"homepage":"https://eemeli.org/yaml/","type":"commonjs","exports":{".":"./dist/index.js","./package.json":"./package.json"},"scripts":{"build":"tsc","clean":"git clean -fdxe node_modules","prettier":"prettier --write .","prepublishOnly":"npm run clean && npm run test","prestart":"tsc","start":"node -i -e 'YAML=require(\"yaml\");YT=require(\"./dist/index.js\")'","pretest":"tsc","test":"tap"},"prettier":{"arrowParens":"avoid","semi":false,"singleQuote":true,"trailingComma":"none"},"tap":{"test-regex":"\\.test\\.js"},"engines":{"node":">= 16","npm":">= 7"},"devDependencies":{"@types/tap":"^15.0.8","prettier":"^2.8.7","tap":"^16.3.4","typescript":"^5.0.4","yaml":"^2.3.0"},"peerDependencies":{"yaml":"^2.3.0"},"gitHead":"4031c9e7cfa5d5813dac9a54403697efb598ca2a","bugs":{"url":"https://github.com/eemeli/yaml-types/issues"},"_id":"yaml-types@0.2.0","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"shasum":"e1ef7558683615578b080556c5d3a04bd4b27b66","size":5976,"noattachment":false,"key":"/yaml-types/-/yaml-types-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/yaml-types/download/yaml-types-0.2.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-types_0.2.0_1684842054890_0.6975895645165013"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-23T11:40:55.040Z","publish_time":1684842055040,"_source_registry_name":"default","_cnpm_publish_time":1684842055040},"0.1.0":{"name":"yaml-types","version":"0.1.0","license":"ISC","author":{"name":"Eemeli Aro","email":"eemeli@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/eemeli/yaml-types.git"},"description":"Useful JavaScript types for YAML","keywords":["YAML","schema","tags"],"homepage":"https://eemeli.org/yaml/","type":"commonjs","exports":{".":"./dist/index.js","./package.json":"./package.json"},"scripts":{"build":"tsc","clean":"git clean -fdxe node_modules","prettier":"prettier --write .","prepublishOnly":"npm run clean && npm run test","prestart":"tsc","start":"node -i -e 'YAML=require(\"yaml\");YT=require(\"./dist/index.js\")'","pretest":"tsc","test":"tap --test-regex '\\.test\\.js$'"},"prettier":{"arrowParens":"avoid","semi":false,"singleQuote":true,"trailingComma":"none"},"engines":{"node":">= 16","npm":">= 7"},"devDependencies":{"@types/tap":"^15.0.8","prettier":"^2.8.7","tap":"^16.3.4","typescript":"^5.0.4","yaml":"^2.3.0-3"},"peerDependencies":{"yaml":"~2"},"gitHead":"bc10eeb09493c1a3a455aa829503089fc896019a","bugs":{"url":"https://github.com/eemeli/yaml-types/issues"},"_id":"yaml-types@0.1.0","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"shasum":"511a201a452034e073f0af081842a0b69fdecaba","size":2523,"noattachment":false,"key":"/yaml-types/-/yaml-types-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/yaml-types/download/yaml-types-0.1.0.tgz"},"_npmUser":{"name":"eemeli","email":"eemeli@gmail.com"},"directories":{},"maintainers":[{"name":"eemeli","email":"eemeli@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yaml-types_0.1.0_1681491042267_0.8371245902955642"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-04-14T16:50:42.433Z","publish_time":1681491042433,"_cnpm_publish_time":1681491042433}},"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","_attachments":{},"homepage":"https://eemeli.org/yaml/","bugs":{"url":"https://github.com/eemeli/yaml-types/issues"},"license":"ISC"}