DiffUtility
Index
Constructors
constructor
Returns DiffUtility
Methods
staticdiffArray
Generate a deep diff of an array of basic types from the previous node vs the latest node.
Parameters
a: UnknownNode
previous node.
b: UnknownNode
latest node.
field: string
string representing the field parent uses to reference the array.
Returns Diff<UnknownNode, unknown>[]
staticdiffArrayOfObjects
Generate a deep diff of an array of objects from the previous node vs the latest node.
Parameters
a: UnknownNode
previous node.
b: UnknownNode
latest node.
field: string
string representing the field parent uses to reference the array.
compare: (object1: unknown, object2: unknown) => boolean
function to check if two objects are equal.
Returns Diff<UnknownNode, unknown>[]
staticdiffMap
Generate a deep diff of a map of basic types from the previous node vs the latest node.
Parameters
a: UnknownNode
previous node.
b: UnknownNode
latest node.
field: string
string representing the field parent uses to reference the map.
Returns Diff<UnknownNode, unknown>[]
staticdiffNodes
Generate a deep diff of an array of previous node vs latest node. The diff is generated recursively, i.e. all children of the node are included in the diff.
Parameters
a: UnknownNode[]
array of previous nodes.
b: UnknownNode[]
array of latest nodes.
field: string
string representing the unique identifier of the node.
Returns Promise<Diff<UnknownNode, unknown>[]>
staticdiffObject
Generate a deep diff of an object from the previous node vs the latest node.
Parameters
a: UnknownNode
previous node.
b: UnknownNode
latest node.
field: string
string representing the field parent uses to reference the object.
Returns Diff<UnknownNode, unknown>[]
staticisObjectDeepEquals
Whether two values are deeply equal.
Parameters
x: unknown
The first value.
y: unknown
The second value.
excludePaths: string[] = []
Dot-separated paths to ignore, e.g.
tags.currentPath: string[] = []
The path walked so far. Callers leave it empty; the recursion fills it.
Returns boolean
Helpers for producing Diffs between two versions of a node.
Use them when overriding
diffProperties()on a model or resource - each one compares a single field of the previous node against the latest, and returns the diffs that field's change implies.Functions/Diff