MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / uniqueEntries

Function uniqueEntries

src/util.ts:693–698  ·  view source on GitHub ↗
(array: T[], isIdentical: (x: T, y: T) => boolean = (x, y) => (x === y))

Source from the content-addressed store, hash-verified

691
692// Keeps only the unique entries in an array, optionally with a custom comparison function
693export function uniqueEntries<T>(array: T[], isIdentical: (x: T, y: T) => boolean = (x, y) => (x === y)){
694 function uniqueFunction(v: T, index: number, array: T[]): boolean {
695 return array.findIndex(v2 => isIdentical(v2, v)) === index;
696 }
697 return array.filter(uniqueFunction);
698}

Callers 1

getMatchingAliasesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected