UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

13 lines (11 loc) 805 B
declare function unique<T>(array: readonly T[]): T[]; declare function uniqueObj<T>(items: readonly T[], uniqueKey: keyof T): T[]; declare function take<T>(array: readonly T[], limit: number): T[]; declare function findLastIndex<T>(array: T[], predicate: (value: T, index: number, obj: T[]) => boolean): number; declare function groupBy<K, V>(list: V[], keyGetter: (input: V) => K): Map<K, V[]>; declare function remove<T>(arr: T[], el: T): void; declare function sample<T>(arr: T[], count: number): T[]; declare function shuffle<T>(array: T[]): T[]; declare function chunk<T>(array: readonly T[], size?: number): T[][]; declare function normalize<T>(array: T[], key: keyof T): Record<typeof key, T>; export { chunk, findLastIndex, groupBy, normalize, remove, sample, shuffle, take, unique, uniqueObj };