{"id":15639783,"url":"https://github.com/borkdude/rewrite-edn","last_synced_at":"2026-01-06T18:19:05.358Z","repository":{"id":40409157,"uuid":"302913170","full_name":"borkdude/rewrite-edn","owner":"borkdude","description":"Utility lib on top of rewrite-clj with common operations to update EDN while preserving whitespace and comments.","archived":false,"fork":false,"pushed_at":"2025-03-17T19:39:57.000Z","size":66,"stargazers_count":88,"open_issues_count":4,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-08T15:53:56.649Z","etag":null,"topics":["babashka","clojure","edn"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borkdude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"borkdude"}},"created_at":"2020-10-10T13:55:15.000Z","updated_at":"2025-05-04T06:22:19.000Z","dependencies_parsed_at":"2024-01-30T01:59:31.799Z","dependency_job_id":"0a784314-8c05-42d1-8b90-fe7384311a33","html_url":"https://github.com/borkdude/rewrite-edn","commit_stats":{"total_commits":61,"total_committers":10,"mean_commits":6.1,"dds":0.2786885245901639,"last_synced_commit":"81de541847438625c5cd10c4a0682cb08e3714e8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Frewrite-edn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Frewrite-edn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Frewrite-edn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borkdude%2Frewrite-edn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borkdude","download_url":"https://codeload.github.com/borkdude/rewrite-edn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"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":["babashka","clojure","edn"],"created_at":"2024-10-03T11:27:18.329Z","updated_at":"2026-01-06T18:19:05.304Z","avatar_url":"https://github.com/borkdude.png","language":"Clojure","funding_links":["https://github.com/sponsors/borkdude"],"categories":[],"sub_categories":[],"readme":"# rewrite-edn\n\n[![Clojars Project](https://img.shields.io/clojars/v/borkdude/rewrite-edn.svg)](https://clojars.org/borkdude/rewrite-edn)\n[![bb compatible](https://raw.githubusercontent.com/babashka/babashka/master/logo/badge.svg)](https://book.babashka.org#badges)\n\nUtility lib on top of\n[rewrite-clj](https://github.com/clj-commons/rewrite-clj) with common\noperations to update EDN while preserving whitespace and comments.\n\n## API\n\nSee docstrings in the `borkdude.rewrite-edn` namespace for details.\n\nCurrently implemented:\n\n- `parse-string`\n- `sexpr`\n- `get`\n- `keys`\n- `assoc`\n- `assoc-in`\n- `update`\n- `update-in`\n- `dissoc`\n- `map-keys`\n- `conj`\n\n## Examples\n\nGiven `deps.edn`:\n\n``` clojure\n{:deps {foo {:mvn/version \"0.1.0\"}\n        bar {:mvn/version \"0.2.0\"}\n        ;; here's a comment and the next dep is ignored:\n        #_baz #_{:mvn/version \"0.3.0\"}}}\n```\n\nand this script:\n\n``` clojure\n(require '[borkdude.rewrite-edn :as r])\n\n(def edn-string (slurp \"deps.edn\"))\n\n(def nodes (r/parse-string edn-string))\n```\n\n### Add dependency\n\n``` clojure\n(println (str (r/assoc-in nodes [:deps 'my-other-dep] {:mvn/version \"0.1.2\"})))\n```\n\n``` clojure\n{:deps {foo {:mvn/version \"0.1.0\"}\n        bar {:mvn/version \"0.2.0\"}\n        ;; here's a comment and the next dep is ignored:\n        #_baz #_{:mvn/version \"0.3.0\"}\n        my-other-dep {:mvn/version \"0.1.2\"}}}\n```\n\n### Fully qualify dep symbols\n\n``` clojure\n(defn qualify-sym-node [sym-node]\n  (let [sym (r/sexpr sym-node)]\n    (if (or (not (symbol? sym))\n            (qualified-symbol? sym))\n      sym-node\n      (symbol (str sym) (str sym)))))\n\n(def updated-nodes (r/update nodes :deps #(r/map-keys qualify-sym-node %)))\n(println (str updated-nodes))\n```\n\n``` clojure\n{:deps {foo/foo {:mvn/version \"0.1.0\"}\n        bar/bar {:mvn/version \"0.2.0\"}\n        ;; here's a comment and the next dep is ignored:\n        #_baz #_{:mvn/version \"0.3.0\"}}}\n```\n\n### Conj + fnil\n\n``` clojure\n(str (r/update (r/parse-string \"{:a [1 2 3]}\") :b (r/fnil r/conj []) 1))\n;;=\u003e \"{:a [1 2 3] :b [1]}\n```\n\nAlso see [examples](examples).\n\n# License\n\nCopyright © 2021 - 2022 Michiel Borkent\n\nDistributed under the EPL License, same as Clojure. See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Frewrite-edn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborkdude%2Frewrite-edn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborkdude%2Frewrite-edn/lists"}