Adds experimental support for Open in GitHub

This commit is contained in:
Eric Amodio
2017-03-24 01:28:05 -04:00
parent ba69a19eeb
commit 4f84c03275
21 changed files with 399 additions and 43 deletions

14
src/system/array.ts Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
export namespace Arrays {
export function uniqueBy<T>(array: T[], accessor: (item: T) => any, predicate?: (item: T) => boolean): T[] {
const uniqueValues = Object.create(null);
return array.filter(_ => {
const value = accessor(_);
if (uniqueValues[value]) return false;
uniqueValues[value] = accessor;
return predicate ? predicate(_) : true;
});
}
}