Function compareArrays

Compares two arrays and returns the items that are only in arrayA, only in arrayB, and in both arrays.

  • Type Parameters

    • T extends unknown[]

    Parameters

    • arrayA: T

      first array

    • arrayB: T

      second array

    Returns {
        both: T;
        onlyA: T;
        onlyB: T;
    }

    an object with three properties: onlyA - items that exists only in first array, onlyB - items that exists only in second array, both - items that exists in both arrays

    • both: T
    • onlyA: T
    • onlyB: T