Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 405 Bytes

README.md

File metadata and controls

28 lines (22 loc) · 405 Bytes

distinct

Find distinct elements in an array of primitives or based on an attribute for objects.

Example

const arr = [
  "banana",
  "strawberry",
  "lemon",
  "banana",
  "strawberry",
  "lemon",
  "banana",
  "strawberry",
  "lemon"
];
const res = arr.distinct();

Also with attribute selector

const data: User[] = [];

const res = arr.distinct(u => u.name);