Skip to content

Instantly share code, notes, and snippets.

@Bazooka2091
Last active September 2, 2021 10:22
Show Gist options
  • Save Bazooka2091/1a2efb71280e6f1a67ea069f4ef44826 to your computer and use it in GitHub Desktop.
Save Bazooka2091/1a2efb71280e6f1a67ea069f4ef44826 to your computer and use it in GitHub Desktop.
TypeScript
const distinct = subjects.filter(
(thing, i, arr) => arr.findIndex(t => t.INN === thing.INN) === i
);
// IE version
const distinctThings = thingsWithDuplicates.filter((thing, i, arr) => {
return arr.indexOf(arr.find(t => t.id === thing.id)) === i;
});
export interface IData {
[ key: string ]: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment