shimi
Version:
A JS framework for building complex MIDI applications
19 lines (18 loc) • 778 B
TypeScript
/**
* Returns the sum of values in the passed in array
* @param array The array to sum up
* @param accessor What value to access from each item in the array
*/
export declare function sum<T>(array: T[], accessor?: (item: T) => number): number;
/**
* Returns an array of only the distinct items in the passed in array
* @param array The array to search through
*/
export declare function distinct<T>(array: T[]): T[];
/**
* Returns the most common value in an array
* @param array The array to search through
* @param accessor What value to access on each item in the array
* @returns Returns the most common accessed value, not the objects where it was found
*/
export declare function mode<TItem, TValue>(array: TItem[], accessor: (item: TItem) => TValue): TValue;