MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / removeDuplicates

Method removeDuplicates

packages/core/src/utils/Utils.ts:845–856  ·  view source on GitHub ↗
(items: T[])

Source from the content-addressed store, hash-verified

843 }
844
845 static removeDuplicates<T>(items: T[]): T[] {
846 const ret: T[] = [];
847 const contains = (arr: unknown[], val: unknown) => !!arr.find(v => equals(val, v));
848
849 for (const item of items) {
850 if (!contains(ret, item)) {
851 ret.push(item);
852 }
853 }
854
855 return ret;
856 }
857
858 static randomInt(min: number, max: number): number {
859 return Math.round(Math.random() * (max - min)) + min;

Callers 4

getIndexesMethod · 0.80
alterTableFunction · 0.80
syncMethod · 0.80
Utils.win.test.tsFile · 0.80

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected