import { DiffTypeBasic, ReducingOperation, ReducingOperationBasic, SortDirection, SortDirectionBasic } from '../common/array'; /** * Get the item of an array at a specific index. * @param arr The array containing the item to retrieve. * @param index The position of the item to retrieve from the array. * * @returns `T` The item retrieved from the array. */ export declare function getAt(arr: T[], index: number): T; /** * Get the subarray of items that exist between the specified starting and ending indices of an array. * @param arr The array containing the items to retrieve. * @param start The starting index of the range to extract from the array. * @param end The ending index of the range to extract from the array. * * @returns `Array` A new array containing the items located between the specified starting and ending indices of the input array. */ export declare function slice(arr: T[], start: number, end: number): T[]; /** * Remove all instances of an item from an array. * @param arr An array containing the item to remove. * @param item The item to remove from the array. * * @returns `Array` The modified array after removing the item at the given index. */ export declare function removeItem(arr: T[], item: T): T[]; /** * Get an array containing the value or array of values of the second input followed by the value or array of values of the first input. * @param value The value or array of values to prepend with `prependValue`. * @param prependValue The value or array of values to prepend to `value`. * * @returns `Array` A new array containing value or array of values of the second input followed by the value or array of values of the first input. */ export declare function prepend(value: L | L[], prependValue: R | R[]): Promise<(L | R)[]>; /** * Return the difference between two arrays based on the type of diff specified. * @param first The first array. * @param second The second array. * @param diffType Whether the returned array should contain the items from the first, second, or both arrays. * * @returns `Array` An array containing the items of one array that do not exist in the other array based on the type of diff specified. */ export declare function diffBasic(first: T[], second: T[], diffType: DiffTypeBasic | DT): T[]; /** * Remove duplicate items from an array. * @param arr The array containing the duplicate values. * * @returns `Array` A new array containing unique values. */ export declare function removeDuplicates(arr: T[]): T[]; /** * Wrap a value in an array if it is not already an array. * @param value The array or value to wrap in array. * * @returns `Array` An array obtained by wrapping the input item in array. */ export declare function force(value: T | T[]): T[]; /** * Flatten an array containing potentially nested arrays to a single array. * @param arr The array to flatten. * * @returns `Array` The flattened array. */ export declare function flatten(arr: T[]): (T extends readonly (infer InnerArr)[] ? InnerArr : T)[]; /** * Extract the values of a property or deeply nested property of the objects within an array of objects. * @param arr The array of objects from which to pluck values. * @param path The JSONata property path of the values to pluck. * * @returns `Array` An array containing the extracted values. */ export declare function pluckBy(arr: T[], path: string): Promise; /** * Sort the items of an array of strings or numbers by value. * @param arr The array to sort by value. * @param direction The sort direction. * @param localeLanguage The locale language to use when comparing values. * * @returns `Array` The sorted array. */ export declare function sort(arr: unknown[], direction?: SortDirection | S | SB, localeLanguage?: string): unknown[]; /** * Sort the items of an array of objects by the value of a plucked property of the objects within the array. * @param arr The array of objects to sort. * @param path The JSONata property path of the values of the objects to compare. * @param direction The sort direction. * @param localeLanguage The locale language to use when comparing values. * * @returns `Array` A new array sorted depends on the path and the type. */ export declare function sortBy(arr: { [path: string]: T; }[], path: string, direction?: SortDirection | SortDirectionBasic | S | SB, localeLanguage?: string): Promise; /** * Count all items of an array that are equal a specific value. * @param arr The array of values to compare and count. * @param value The value to count. * * @returns The count of all items equal to the specified value. */ export declare function countIf(arr: T[], value: unknown): number; /** * Count all items of an array of objects that contain a plucked property equal to a specific value. * @param arr The array of objects to count. * @param path The JSONata property path of the values of the objects to compare and count. * @param value The value to count. * * @returns The count of all objects containing a property equal to the specified value. */ export declare function countIfBy(arr: { [path: string]: T; }[], path: string, value: string): Promise; /** * Apply a reducing operation to the values of a numeric array. * @param arr The array of items to reduce. * @param operation The reducing operation to perform. * * @returns The reduced value. */ export declare function reduce(arr: number[], operation: ReducingOperation | ReducingOperationBasic | O | OB): number | undefined; /** * Apply a reducing operation to the values of a plucked property of the objects within an array of objects. * @param arr The array of objects to reduce. * @param operation The reducing operation to perform. * @param path The JSONata property path of the values to reduce. * * @returns The reduced value. */ export declare function reduceBy(arr: T[], operation: ReducingOperation | ReducingOperationBasic | O | OB, path: string): Promise; /** * Sum the values of an array of numbers. * @param arr The array containing the values to sum. * * @returns The sum of the values. */ export declare function sum(arr: number[]): number | undefined; /** * Sum the values of a plucked property of the objects within an array of objects. * @param arr The array of objects containing the values to sum. * @param path The JSONata property path of the values to sum. * * @returns The sum of the property values. */ export declare function sumBy(arr: T[], path: string): Promise; /** * Average the values of an array of numbers. * @param arr The array containing the values to average. * * @returns The average value. */ export declare function avg(arr: number[]): number | undefined; /** * Average the values of a plucked property of the objects within an array of objects. * @param arr The array of objects containing the values to average. * @param path The JSONata property path of the values to average. * * @returns Return the avg number. */ export declare function avgBy(arr: T[], path: string): Promise; /** * Find the minimum value in an array of numbers. * @param arr The array containing the values to search. * * @returns The minimum value found. */ export declare function min(arr: number[]): number | undefined; /** * Find the minimum value of a plucked property of the objects within an array of objects. * @param arr The array of objects containing the values to search. * @param path The JSONata property path of the values to search. * * @returns The minimum value found. */ export declare function minBy(arr: T[], path: string): Promise; /** * Find the maximum value in an array of numbers. * @param arr The array containing the values to search. * * @returns The maximum value found. */ export declare function max(arr: number[]): number | undefined; /** * Find the maximum value of a plucked property of the objects within an array of objects. * @param arr The array of objects containing the values to search. * @param path The JSONata property path of the values to search. * * @returns The maximum value found. */ export declare function maxBy(arr: T[], path: string): Promise; /** * Compute the mean of the values in an array of numbers. * @param arr The array containing the values to average. * * @returns The mean value. */ export declare function mean(arr: number[]): number; /** * Compute the mean of the values plucked from objects within an array of objects. * @param arr The array of objects containing the values to average. * @param path The JSONata property path of the values to search. * * @returns The mean value. */ export declare function meanBy(arr: T[], path: string): Promise; /** * Filter an array to the values that match a regular expression, a specific value, or non-null value. * * @param arr The array to filter. * @param filterValue The filter value or regular expression to match. * * @returns The filtered values. */ export declare function filter(arr: T[], filterValue?: string | T): T[]; /** * Filter an array of objects to those that contain a property or deeply nested property whose values match a regular * expression, a specific value, or non-null value. * * @param arr The array to filter. * @param path The JSONata property path of the values to compare. * @param filterValue The filter value or regular expression to match. * * @returns The filtered objects that contain a property or deeply nested property whose values match the filter value. */ export declare function filterBy(arr: T[], path: string, filterValue?: string | T): Promise;