Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: fixed uniq
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 17, 2018
1 parent 1804e79 commit 0682c7a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ export function compact<T>(a: (T | undefined)[]): T[] {
}

export function uniq<T>(arr: T[]): T[] {
return arr.filter((a, i) => arr.findIndex(b => b === a) === i)
return arr.filter((a, i) => {
return !arr.find((b, j) => j > i && b === a)
})
}

0 comments on commit 0682c7a

Please sign in to comment.