• Returns true if all the entities are distinct by the property value argument.

    Type Parameters

    • E

    Parameters

    • entities: E[]

      The entities in the array.

    • property: keyof E

      The name of the property to check for distinct values by.

    Returns boolean

    Example

     let todos: Todo[] = [
    { id: 1, title: "Lets do it!" },
    { id: 1, title: "Lets do it again!" },
    { id: 2, title: "All done!" }
    ];

    let todos2: Todo[] = [
    { id: 1, title: "Lets do it!" },
    { id: 2, title: "All done!" }
    ];

    expect(unique(todos, "id")).toBeFalsy();
    expect(unique(todos2, "id")).toBeTruthy();

Generated using TypeDoc