import { type MapFunction } from '../value/map'; import { type DecisionFunction } from '../value/decision'; import { type AscendingSortCompareFunction } from '../sort'; /** * Filters the input values by distance while maintaining the original order of elements. * Values that are too close to each other (based on the minDistance parameter) will be filtered out. * * If order is irrelevant, use filterValuesByDistanceNoOrder() instead. * * @param _input - The array of values to filter * @param _minDistance - The minimum distance required between values * @param _getValue - Function that extracts a numeric value from each item for distance comparison * @returns A filtered array with only values that are at least minDistance apart */ export declare function filterValuesByDistance(_input: T[], _minDistance: number, _getValue: (value: T) => number | null): T[]; /** * Filters the input values by an arbitrary "distance"/difference from each other and returns the values sorted by their determined distance. * * This is useful in cases where many values are too "close" to each other (generally items that share the same time, or within seconds of each other), and * we are only interested in seeing one of those items. * * @param input - The array of values to filter * @param minDistance - The minimum distance required between values (inclusive) * @param getValue - Function that extracts a numeric value from each item for distance comparison * @returns A filtered array with only values that are at least minDistance apart, sorted by the extracted value */ export declare function filterValuesByDistanceNoOrder(input: T[], minDistance: number, getValue: (value: T) => number | null): T[]; /** * Same as applyBestFit, but returns a new array, rather than modifying the existing array. * * @param input - The array to filter for the best fit * @param filter - Function that determines which items are candidates for the best fit * @param compare - AscendingSortCompareFunction to compare two values to determine which is the best fit * @param updateNonBestFit - Function that transforms non-best-fit items * @returns A new array with only the best fit item and transformed non-best-fit items */ export declare function makeBestFit(input: T[], filter: (value: T) => boolean, compare: AscendingSortCompareFunction, updateNonBestFit: (value: T) => T): T[]; /** * Used for updating an array so that a single element becomes the "best fit" in whatever context is provided. * * For instance, if two items are selected but only one can be selected by design, this function can be used to * pick the best fit, and update the input array. * * @param input - The array to modify in-place * @param filter - Function that determines which items are candidates for the best fit * @param compare - AscendingSortCompareFunction to compare two values to determine which is the best fit * @param updateNonBestFit - Function that transforms non-best-fit items * @returns The modified input array with only the best fit item and transformed non-best-fit items */ export declare function applyBestFit(input: T[], filter: (value: T) => boolean, compare: AscendingSortCompareFunction, updateNonBestFit: (value: T) => T): T[]; /** * Filters and maps the input values to an array. * Combines filtering and mapping operations into a single pass over the data. */ export type FilterAndMapFunction = MapFunction, O[]>; /** * Creates a function that filters the input values and maps all matching values to a new value. * This is a higher-order function that combines filtering and mapping operations. * * @param decisionFunction - Function that determines which items to include in the result * @param mapFunction - Function that transforms each included item * @returns A function that takes an iterable of input values and returns an array of transformed values */ export declare function filterAndMapFunction(decisionFunction: DecisionFunction, mapFunction: MapFunction): FilterAndMapFunction;