Skip to main content

DiffUtility

@group

Functions/Diff

Index

Constructors

constructor

Methods

staticdiffArray

  • diffArray(a: UnknownNode, b: UnknownNode, field: string): Diff<UnknownNode, unknown>[]
  • 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

  • diffArrayOfObjects(a: UnknownNode, b: UnknownNode, field: string, compare: (object1: unknown, object2: unknown) => boolean): Diff<UnknownNode, unknown>[]
  • 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

    • diffMap(a: UnknownNode, b: UnknownNode, field: string): Diff<UnknownNode, unknown>[]
    • 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

    • diffNodes(a: UnknownNode[], b: UnknownNode[], field: string): Promise<Diff<UnknownNode, unknown>[]>
    • 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

    • diffObject(a: UnknownNode, b: UnknownNode, field: string): Diff<UnknownNode, unknown>[]
    • 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

    • isObjectDeepEquals(x: unknown, y: unknown, excludePaths?: string[], currentPath?: string[]): boolean
    • Parameters

      • x: unknown
      • y: unknown
      • excludePaths: string[] = []
      • currentPath: string[] = []

      Returns boolean