File tree Expand file tree Collapse file tree
test/lambdaisland/deep_diff2 Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11# Unreleased
22
3- ## Added
3+ ## Changed
4+
5+ - General dependency and tooling version bumps
46
57## Fixed
68
79- Fixed puget printer for futures
810
911## Changed
1012
13+ - Fix ` mimimize ` when inserting/removing map keys (should preserve associated
14+ value)
15+ - Add ` minimise ` variant
16+
1117# 2.12.219 (2025-02-06 / 9e6942a)
1218
1319## Changed
Original file line number Diff line number Diff line change 11{:deps
22 {lambdaisland/deep-diff2 {:local/root " ." }
33 lambdaisland/open-source {:git/url " https://github.com/lambdaisland/open-source"
4- :git/sha " e0e234aea52aeafac6ebb06c4a5149d83977e6a0 " }}
4+ :git/sha " 34ce20d7b2af747227c345b392fe92cb5f4d3cda " }}
55 :tasks
66 {test:bb {:doc " Run babashka tests with custom runner"
77 :extra-paths [" src" " test" ]
Original file line number Diff line number Diff line change 11{:paths [" resources" " src" ]
2- :deps {fipp/fipp {:mvn/version " 0.6.27 " }
3- org.clojure/core.rrb-vector {:mvn/version " 0.2.0 " }
2+ :deps {fipp/fipp {:mvn/version " 0.6.29 " }
3+ org.clojure/core.rrb-vector {:mvn/version " 0.2.1 " }
44 lambdaisland/clj-diff {:mvn/version " 1.4.78" }
55 mvxcvi/arrangement {:mvn/version " 2.1.0" }}
66
77 :aliases {:cljs
8- {:extra-deps {org.clojure/clojurescript {:mvn/version " 1.11.132 " }}}
8+ {:extra-deps {org.clojure/clojurescript {:mvn/version " 1.12.134 " }}}
99
1010 :dev
1111 {}
1212
1313 :chui
1414 {:extra-deps {lambdaisland/chui {:local/root " ../chui" }
15- thheller/shadow-cljs {:mvn/version " 2.28.20 " }
15+ thheller/shadow-cljs {:mvn/version " 3.3.8 " }
1616 garden/garden {:mvn/version " 1.3.10" }}
1717 :extra-paths [" ../chui/resources" " ../chui/dev" ]}
1818
1919 :test
2020 {:extra-paths [" test" ]
2121 :extra-deps {lambdaisland/kaocha {:mvn/version " 1.91.1392" }
22- com.lambdaisland/kaocha-cljs {:mvn/version " 1.5.154 " }
23- org.clojure/clojurescript {:mvn/version " 1.11.132 " }
24- org.clojure/test.check {:mvn/version " 1.1.1 " }}}}}
22+ com.lambdaisland/kaocha-cljs {:mvn/version " 1.9.181 " }
23+ org.clojure/clojurescript {:mvn/version " 1.12.134 " }
24+ org.clojure/test.check {:mvn/version " 1.1.3 " }}}}}
Original file line number Diff line number Diff line change 44 "dependencies" : {
55 "react" : " ^16.13.1" ,
66 "react-dom" : " ^16.13.1" ,
7- "ws" : " ^8.18 .0"
7+ "ws" : " ^8.20 .0"
88 }
99}
Original file line number Diff line number Diff line change 11(ns lambdaisland.deep-diff2
2+ " Diff datastructures deeply, and pretty-print the result"
23 (:require
34 [lambdaisland.deep-diff2.diff-impl :as diff-impl]
4- [lambdaisland.deep-diff2.printer -impl :as printer-impl ]
5- [lambdaisland.deep-diff2.minimize -impl :as minimize ]))
5+ [lambdaisland.deep-diff2.minimise -impl :as minimise ]
6+ [lambdaisland.deep-diff2.printer -impl :as printer-impl ]))
67
78(defn diff
89 " Compare two values recursively.
4445 (printer-impl/format-doc printer)
4546 (printer-impl/print-doc printer))))
4647
48+ (defn minimise
49+ " Return a minimal diff, removing any values that haven't changed."
50+ [diff]
51+ (minimise/minimise diff))
52+
4753(defn minimize
4854 " Return a minimal diff, removing any values that haven't changed."
4955 [diff]
50- (minimize/minimize diff))
56+ (minimise/minimise diff))
Original file line number Diff line number Diff line change 11(ns lambdaisland.deep-diff2.diff-impl
2- (:require [clojure.data :as data]
3- [clojure.set :as set]
4- [lambdaisland.clj-diff.core :as seq-diff]))
2+ (:require
3+ [clojure.data :as data]
4+ [clojure.set :as set]
5+ [lambdaisland.clj-diff.core :as seq-diff]))
56
67(declare diff diff-similar diff-meta )
78
Original file line number Diff line number Diff line change 1+ (ns lambdaisland.deep-diff2.minimise-impl
2+ " Provide API for manipulate the diff structure data "
3+ (:require
4+ [clojure.walk :refer [postwalk]]
5+ #?(:clj [lambdaisland.deep-diff2.diff-impl]
6+ :cljs [lambdaisland.deep-diff2.diff-impl :refer [Mismatch Deletion Insertion]]))
7+ #? (:clj (:import [lambdaisland.deep_diff2.diff_impl Mismatch Deletion Insertion])))
8+
9+ (defn diff-item?
10+ " Checks if x is a Mismatch, Deletion, or Insertion"
11+ [x]
12+ (or (instance? Mismatch x)
13+ (instance? Deletion x)
14+ (instance? Insertion x)))
15+
16+ (defn has-diff-item?
17+ " Checks if there are any diff items in x or sub-tree of x"
18+ [x]
19+ (or (diff-item? x)
20+ (and (map? x) (some #(or (has-diff-item? (key %))
21+ (has-diff-item? (val %))) x))
22+ (and (coll? x) (some has-diff-item? x))))
23+
24+ (defn minimise
25+ " Postwalk diff, removing values that are unchanged"
26+ [o]
27+ (cond
28+ (diff-item? o)
29+ o
30+
31+ (map-entry? o)
32+ (cond
33+ (has-diff-item? (key o))
34+ o
35+ (has-diff-item? (val o))
36+ #?(:clj
37+ (clojure.lang.MapEntry/create (key o) (minimise (val o)))
38+ :cljs
39+ (MapEntry. (key o) (minimise (val o)))))
40+
41+ (record? o)
42+ (into o (map minimise) o)
43+
44+ (map? o)
45+ (into {} (keep minimise) o)
46+
47+ (coll? o)
48+ (if (has-diff-item? o)
49+ (into (empty o) (keep minimise) o)
50+ (empty o))
51+
52+ :else
53+ nil ))
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11(ns lambdaisland.deep-diff2.printer-impl
2- (:require [arrangement.core]
3- [fipp.engine :as fipp]
4- [lambdaisland.deep-diff2.diff-impl :as diff]
5- [lambdaisland.deep-diff2.puget.color :as color]
6- [lambdaisland.deep-diff2.puget.dispatch :as dispatch]
7- [lambdaisland.deep-diff2.puget.printer :as puget-printer]
8- #?(:cljs [goog.string :refer [format]]))
2+ (:require
3+ [arrangement.core]
4+ [fipp.engine :as fipp]
5+ [lambdaisland.deep-diff2.diff-impl :as diff]
6+ [lambdaisland.deep-diff2.puget.color :as color]
7+ [lambdaisland.deep-diff2.puget.dispatch :as dispatch]
8+ [lambdaisland.deep-diff2.puget.printer :as puget-printer]
9+ #?(:cljs [goog.string :refer [format]]))
910 #? (:clj
1011 (:import )))
1112
You can’t perform that action at this time.
0 commit comments