{"id":17145070,"url":"https://github.com/jorinvo/edn-data","last_synced_at":"2025-04-05T17:09:46.780Z","repository":{"id":41232196,"uuid":"272616703","full_name":"jorinvo/edn-data","owner":"jorinvo","description":"EDN parser and generator that works with plain JS data, with support for TS and node streams","archived":false,"fork":false,"pushed_at":"2024-06-18T03:37:50.000Z","size":463,"stargazers_count":101,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T16:09:52.912Z","etag":null,"topics":["clojure","data-format","edn","javascript","node-stream","parser","serialization","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jorinvo.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}},"created_at":"2020-06-16T05:22:41.000Z","updated_at":"2025-01-20T22:37:05.000Z","dependencies_parsed_at":"2022-09-15T04:41:00.117Z","dependency_job_id":"89c3f016-5dd7-455a-ba3f-d3b70fb02466","html_url":"https://github.com/jorinvo/edn-data","commit_stats":{"total_commits":53,"total_committers":6,"mean_commits":8.833333333333334,"dds":"0.41509433962264153","last_synced_commit":"1e5824f63803eb58f35e98839352000053d47115"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorinvo%2Fedn-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorinvo%2Fedn-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorinvo%2Fedn-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorinvo%2Fedn-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jorinvo","download_url":"https://codeload.github.com/jorinvo/edn-data/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369954,"owners_count":20927928,"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":["clojure","data-format","edn","javascript","node-stream","parser","serialization","typescript"],"created_at":"2024-10-14T21:04:21.738Z","updated_at":"2025-04-05T17:09:46.740Z","avatar_url":"https://github.com/jorinvo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edn-data\n\n`edn-data` is a JavaScript and TypeScript library that provides functionality to generate and parse data in the [EDN format](https://github.com/edn-format/edn), as known from [Clojure](https://clojure.org/) land.\n\n\n## Why create another library for working with EDN?\n\n- Support TypeScript with a strictly typed interface\n- Support the rich EDN types\n- Allow working with plain data in JavaScript, so everything can also be serialized to JSON\n- Support modern JavaScript types such as `Map`, `Set` and `bigint`\n- Support streaming EDN lists as standard [Node stream](https://nodejs.org/api/stream.html) in Node.js\n- Have a solution that works in Node.js and in browsers\n\n\n## Why work with EDN in JavaScript or TypeScript?\n\nThe number one reason is, your code wants to interact with data coming from Clojure.\n\nBut even outside Clojure EDN can be a compelling data format in a world where developers are stuck [fighting YAML](https://twitter.com/jorinvo/status/1283859530695290886)\nand [complaining about JSON](https://twitter.com/jorinvo/status/1303095726189228032).\n\nEDN has:\n\n- less syntax than JSON\n- built-in data types to represent maps, sets, keywords, dates, uuids, chars, bigints, ...\n- multi-line strings\n- tags and symbols to represent rich, custom data types\n- comments\n- streaming parsers\n- no relevant whitespace\n\n\n## Get started\n\nInstall with:\n\n```\nnpm install edn-data\n```\n\n### Parsing EDN\n\nBy default parsing returns JSON-compatible data structures that can represent all of the rich EDN types.\n\nThere are options to make it easier to parse simpler types.\n\n```js\nimport { parseEDNString } from 'edn-data'\n\nparseEDNString('{:key \"value\" :list [1 2 3]}')\n// Returns:\n{\n  map: [\n    [{ key: 'key' }, 'value'],\n    [{ key: 'list' }, [1, 2, 3]],\n  ],\n}\n\nparseEDNString(\n  '{:key \"value\" :list [1 2 3]}',\n  { mapAs: 'object', keywordAs: 'string' },\n)\n// Returns:\n{\n  key: 'value',\n  list: [1, 2, 3],\n}\n```\n\nEDN lists can be streamed value by value as standard Node.js Readable streams.\nThis is not available in the browser.\n\n```js\nimport { parseEDNListStream } from 'edn-data/stream'\n\nconst s = parseEDNListStream()\ns.write('(1 2 3)')\ns.read() // 1\ns.read() // 2\ns.read() // 3\n```\n\n\n### Generating EDN\n\nEDN is generated from plain JSON structures.\n\nWith `toEDNString` the same data structures `parseEDNString` returns can be turned to valid strings, and they represent a rich set of types.\n\nFor simple JavaScript types often `toEDNStringFromSimpleObject` might be the simpler use.\n\n```js\nimport { toEDNString, toEDNStringFromSimpleObject } from 'edn-data';\n\ntoEDNString({\n  map: [\n    [1, { key: 'keyword' }],\n    [{ set: [1, 2] }, { char: 'a' }],\n  ],\n})\n// Returns:\n'{1 :keyword #{1 2} \\a}'\n\ntoEDNStringFromSimpleObject({ first: 1, second: 2 })\n// Returns:\n'{:first 1 :second 2}'\n```\n\n\n## Development\n\nThe library is developed driven by its tests.\n\nVerify them using\n\n```\nnpm test\n```\n\nFor continuous development use\n\n```\nnpm run test:watch\n```\n\nEnsure the code formatting with\n\n```\nnpm run fix\n```\n\nCI verifies tests and creates npm releases for tags automatically.\n\n\n### Publish a new version\n\n1. Change the `version` in the `package.json`\n2. Push a commit to master in the following form `Release \u003cversion\u003e`\n3. A Git tag will be created and the new version will be published to NPM\n\n\n## License\n\n[MIT](./license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorinvo%2Fedn-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorinvo%2Fedn-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorinvo%2Fedn-data/lists"}