@quinck/collections
Version:
Allows extra operations on JavaScript collections: Array, Map and Set.
19 lines (18 loc) • 724 B
TypeScript
export {};
import '../maps/toArray';
import './groupBy';
declare global {
interface Array<T> {
/**
* Returns a new Array containing only the distinct elements of the original Array.
* @returns a new Array containing only the distinct elements of the original Array
*/
distinct(): Array<T>;
/**
* Returns a new Array containing only the distinct elements of the original Array.
* @param f A function that receives an element of the Array and returns a value used to compare the elements
* @returns a new Array containing only the distinct elements of the original Array
*/
distinctBy<S>(f: (value: T) => S): Array<T>;
}
}