The Diff class stores the difference between two Haxe dynamic objects first and second. You can later apply the diff object to first to obtain second, or swap the diff and then apply to second to get first.

Constructor

new(first:Dynamic, second:Dynamic)

Creates a new Diff storing the differences between the two objects passed. The differences basically are:

  • Additions: Fields present in second that are not present in first.
  • Deletions: Fields present in first that are not present in second.
  • Changes: Fields whose value has changed between first and second.

The class is capable of tracking changes inside arrays.

Methods

apply(obj:Dynamic):Dynamic

Applies to changes in this Diff to the dynamic object passed as argument. If this method is called on the first object passed when constructing this, then an object identical to second is returned.

swap():Diff

Returns a new Diff that reverts the changes made by this one. If apply is called on the returned Diff passing the second argument used to construct this, then and object identical to the first argument used to construct this will be returned by apply.

toString():String

Returns a string with the Json representation of this Diff.