type CompareFn = < T > ( a : T , b : T ) => boolean ; const compareEqual = < T > ( a , b ) => a === b ; export const unique = < T > ( items , compare = compareEqual ) : T [ ] => items . filter ( ( elem , pos , arr ) => arr . findIndex ( ( a ) => compare ( a , elem ) ) === pos ) ;