/** * Create a numeric array for the given range. * * @example * // creates an array with n elements 0...(n - 1) * createRange(n) * createRange(3) // => [0, 1, 2] * createRange(1) // => [0] * createRange(0) // => [] * createRange(-1) // => RangeError: Invalid array length * * @example * // creates an array from to (inclusive) * createRange(from, to) * createRange(1, 3) // => [1, 2, 3] * createRange(-2, 2) // => [-2, -1, 0, 1, 2] */ export declare const createRange: (s: number, e?: number) => number[]; /** * Calculate the sum of a numeric array. */ export declare const getArraySum: (array: number[]) => number; /** * Remove an item from an array (returns a new array). */ export declare const removeFromArray: (array: T[], item: T) => T[]; /** * Get the last element of an array. */ export declare const getLastElement: (array: T[]) => T; /** * Get the previous sibling of an array element. */ export declare const getPrevSibling: (array: (T | undefined)[], item: T | undefined) => T | undefined; /** * Get the next sibling of an array element. */ export declare const getNextSibling: (array: (T | undefined)[], item: T | undefined) => T | undefined; /** * Use a Set to get only the unique values of an array. */ export declare const makeArrayUnique: (array: T[]) => T[]; /** * Get the count of elements of an array that pass the filter, and return either the count or the limit (whatever is smaller) as a string. The default limit is 99. * * If no limit should be applied, pass `0` as the limit. */ export declare const getCountWithLimit: (array: T[], filterFn: (value: T) => boolean, limit?: number) => string; /** * Reduce an array of objects to an object. * * @example * reduceObjectArrayToObject([{ a: 'foo' }, { b: 'bar' }]) * // => { a: 'foo', b: 'bar' } */ export declare const reduceObjectArrayToObject: (array: { [key: string]: any; }[]) => { [key: string]: any; }; /** * Get a function that can be passed into `Array#sort` to sort an array of objects by the given key. */ export declare const sortByKey: (key: string) => (a: T, b: T) => 0 | 1 | -1; /** * Flatten an array. */ export declare const flatten: (array: T[][]) => T[];