UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

26 lines (24 loc) 1.26 kB
declare const equalSizeGroups: <T>(array: T[], groupSize: number) => T[][]; /** * @param start * @param end inclusive * @param allowEmptyRange Whether the range can be defined empty via end < start */ declare const range: (start: number, end: number, allowEmptyRange?: boolean) => number[]; /** Finds the closest match * @param list The list of all possible matches * @param firstCloser Return whether item1 is closer than item2 */ declare const closestMatch: <T>(list: T[], firstCloser: (item1: T, item2: T) => boolean) => T; /** * returns the item in middle of a list and its neighbours before and after * e.g. [1,2,3,4,5,6] for item = 1 would return [5,6,1,2,3] */ declare const getNeighbours: <T>(list: T[], item: T, neighbourDistance?: number) => T[]; declare const createLoopingListWithIndex: <T>(list: T[], startIndex?: number, length?: number, forwards?: boolean) => [number, T][]; declare const createLoopingList: <T>(list: T[], startIndex?: number, length?: number, forwards?: boolean) => T[]; declare const ArrayUtil: { unique: <T>(list: T[]) => T[]; difference: <T>(list: T[], removeList: T[]) => T[]; }; export { ArrayUtil, closestMatch, createLoopingList, createLoopingListWithIndex, equalSizeGroups, getNeighbours, range };