Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 3x 3x 1x 3x 3x 3x 14x | import { RecordProps } from "@props/RecordProps"; export function removeItem<T>(arr: Array<T>, value: T): Array<T> { const index = arr.indexOf(value); if (index > -1) { arr.splice(index, 1); } return arr; } export function removeDuplicate<T>(arr: Array<T>): Array<T> { return [...new Set(arr)]; } export function removeDuplicateById(arr: Array<RecordProps>): Array<RecordProps> { return arr.filter((item: RecordProps, index: number, self: Array<RecordProps>) => { return self.findIndex((t: RecordProps) => t.id === item.id) === index; }); } |