{"id":16138214,"url":"https://github.com/ul/differ","last_synced_at":"2025-03-18T16:30:46.091Z","repository":{"id":23655894,"uuid":"27026543","full_name":"ul/differ","owner":"ul","description":"A library to diff and patch clojure(script) datastructures","archived":false,"fork":false,"pushed_at":"2014-11-23T18:34:30.000Z","size":148,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"development","last_synced_at":"2025-03-08T17:08:55.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-23T08:34:29.000Z","updated_at":"2019-04-19T13:30:23.000Z","dependencies_parsed_at":"2022-08-21T21:00:32.155Z","dependency_job_id":null,"html_url":"https://github.com/ul/differ","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fdiffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fdiffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fdiffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fdiffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ul","download_url":"https://codeload.github.com/ul/differ/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243940088,"owners_count":20372045,"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-09T23:33:02.502Z","updated_at":"2025-03-18T16:30:45.786Z","avatar_url":"https://github.com/ul.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Differ [![Travis CI status](https://api.travis-ci.org/Skinney/differ.png)](http://travis-ci.org/#!/Skinney/differ/builds)\n\nA library for diffing, and patching, Clojure(script) datastructures.\n\n## Motivation\n\nI wanted to implement an auto-save feature for my Clojurescript web-app. To be efficient, only the actual changes should be sent to the backend. `clojure.data/diff` is not the easiest function to work with for several reasons, and there didn't seem to be any good alternatives, so differ was born.\n\n## Setup\n\nAdd the following the to your `project.clj`:\n\n[![Clojars Project](http://clojars.org/differ/latest-version.svg)](http://clojars.org/differ)\n\n## Usage\n\nFirst of all, you need to require the proper namespace:\n\n```clojure\n(ns some.ns\n  (:require [differ.core :as differ]))\n```\n\nYou can create a diff using the `differ.core/diff` function:\n\n```clojure\n(def person-map {:name \"Robin\"\n                 :age 25\n                 :sex :male})\n\n(def person-diff (differ/diff test-map {:name \"Robin Heggelund Hansen\"\n                                        :age 26})\n\n;; person-diff will now be [{:name \"Robin Heggelund Hansen\", :age 26}\n;;                          {:sex 0}]\n```\n\n`differ.core/diff` will return a datastructure of the same type that is given, and will work with nested datastructures. If you only want alterations, or removals, instead of both, please check the `differ.diff` and `differ.patch` namespaces.\n\nNOTE: Currently, only maps are supported.\n\nTo apply the diff, you can use the `differ.core/patch` function. This function works on any similar datastructure:\n\n```clojure\n(differ/patch {:specie :dog\n               :sex :female}\n              person-diff)\n\n;; Will return {:name \"Robin Heggelund Hansen\"\n;;              :age 26\n;;              :specie :dog}\n```\n\n## Contributing\n\nFeedback to both this library and this guide is welcome. Plese read `CONTRIBUTING.md` for more information.\n\n### Running the tests\n\nDiffer is assumed to work with Clojure 1.6 and up, as well as Clojurescript 2371 and up.\n\nThere is a leiningen alias that makes it easy to run the tests against supported Clojure versions:\n\n```bash\nλ lein all-tests\n```\n\n## License\n\nCopyright © 2014 Robin Heggelund Hansen.\n\nDistributed under the [MIT License](http://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fdiffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ful%2Fdiffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fdiffer/lists"}