All right! MapDiff is updated to 1.1.0.
The single but important new feature: Supporting structs in a meaningful way.
- comparing two structs of the same type returns a map of fields that were changed.
- comparing two structs of a different type returns a primitive_change where the whole of the old struct was replaced for the whole of the new struct.
Examples:
iex> MapDiff.diff(%Foo{}, %Foo{a: 3})
%{changed: :map_change, struct_name: Foo,
value: %{a: %{added: 3, changed: :primitive_change, removed: 1},
b: %{changed: :equal, value: 2}, c: %{changed: :equal, value: 3}}}
When comparing two different kinds of structs, this of course results in a :primitive_change, as they are simply considered primitive data types:
iex> MapDiff.diff(%Foo{}, %Bar{})
%{added: %Bar{a: "foo", b: "bar", z: "baz"}, changed: :primitive_change,
removed: %Foo{a: 1, b: 2, c: 3}}






















