Releases: adamhamlin/deep-equality-data-structures
v2.0.0
Adding 2 breaking changes:
-
Changed/improved the semantics for
DeepMap.difference()
andDeepMap.intersection()
such that they will only consider an entry to "match" if both the key and its value are equivalent--instead of just the key.const map1 = new DeepMap([[1, "dog"], [2, "cat"]]); const map2 = new DeepMap([[1, "dog"], [2, "laser-cat"]]); const pairsInMap1NotInMap2 = map1.difference(map2); const pairsInBothMaps = map1.intersection(map2); expect([...pairsInMap1NotInMap2.entries()]).toStrictEqual([[2, "cat"]]); // previously would have been: [[]] expect([...pairsInBothMaps.entries()]).toStrictEqual([[1, "dog"]]); // previously would have been: [[1, "dog"], [2, "cat"]]
-
Library will now enforce that two structures are using the same options during comparison operations like
.equals
,.union
, etc. This is to prevent a potential footgun/unexpected behavior.const set1 = new DeepSet(["DOG", "CAT"]); const set2 = new DeepSet(["dog", "cat"], { caseInsensitive: true }); set1.equals(set2); // errors; previously, no error
v1.5.1
Exporting the Options
type for ease of use
v1.5.0
- Adding
caseInsensitive
option to ignore casing in all strings, including keys/values in objects and arrays - Allowing
useToJsonTransform
option in combination withtransformer
/mapValueTransformer
options
v1.4.0
Adding BiDirectionalDeepMap
to support O(1) lookups by both keys AND values
v1.3.1
Ignore jest config file during npm publish
v1.3.0
Adding the static areEqual
utility method for one-time equality checks against an arbitrary number of values.
v1.2.1
Fix high severity CVE
v1.2.0
Adding binary operations union
, intersection
, and difference
for both maps and sets.
v1.1.0
Type safety improvements when using the custom transform functions transformer
and mapValueTransformer
v1.0.3
Properly sets typescript as a dev dependency.