/** * Sorts an array using a "map callback" (like Python's `key` argument in `sorted`) * before comparing. This allows you to sort by a derived value instead of the item itself. * * - Items mapped to `undefined` are always moved to the end. * - If `compareFn` is not provided, values are compared as strings using `localeCompare`. * - Sorting is stable: items with equal mapped values preserve their original order. * * @typeParam T - The type of elements in the input array. * @typeParam U - The type of the mapped "sortable" values. * * @param list - The array to sort. * @param mapFn - A function that maps each element to a sortable value. * If it returns `undefined`, that element will be placed at the end. * @param compareFn - Optional comparison function for the mapped values. * Defaults to lexicographic string comparison. * * @returns A new array of the original items, sorted by their mapped values. * * @example * ```ts * // Sort numbers by their absolute value * const result = mapSort([-5, 3, -2, 8], n => Math.abs(n)); * // => [-2, 3, -5, 8] * * // Sort objects by a field * const users = [ * { name: "Alice", age: 30 }, * { name: "Bob", age: 25 }, * { name: "Charlie", age: 25 }, * ]; * * const sorted = mapSort(users, u => u.age); * // => Bob (25), Charlie (25), Alice (30) * ``` */ export declare const mapSort: (list: T[], mapFn?: (item: T, index: number, array: T[]) => U | undefined, compareFn?: (a: U, b: U) => number) => T[]; export { }