Function uniqueArrayOfObjects

  • Compares all the objects (both key and value) in the given array and returns the unique array.

    Parameters

    • arr: object[]

      An array of objects.

    Returns object[]

    • The unique array of objects.

    Example

    uniqueArrayOfObjects([{a: 2}, {a: 2}]); // [{"a":  2}]

    uniqueArrayOfObjects([{a: {b: 2}}, {a: {b: 2}}]); // [{"a": {"b": 2}}]

    uniqueArrayOfObjects([{a: 2}, {a: 2, b: 3}]); // [{a: 2}, {a: 2, b: 3}]

Generated using TypeDoc