import { ListIteratee } from "../_internal/ListIteratee.js"; import { ListIterator } from "../_internal/ListIterator.js"; import { ObjectIterator } from "../_internal/ObjectIterator.js"; import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; import { Many } from "../_internal/Many.js"; //#region src/compat/array/orderBy.d.ts type Criterion = ((item: T) => unknown) | PropertyKey | PropertyKey[] | null | undefined; /** * Sorts an array of elements based on multiple iteratee functions and their corresponding order directions. * * @template T The type of elements in the array * @param {ArrayLike | null | undefined} collection The array to sort * @param {Many>} iteratees The iteratee functions to sort by * @param {Many} orders The sort orders * @returns {T[]} Returns the new sorted array * @example * const users = [ * { name: 'fred', age: 48 }, * { name: 'barney', age: 34 } * ]; * * // Sort by age in ascending order * orderBy(users, [(user) => user.age], ['asc']); * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] */ declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; /** * Sorts an array of elements based on multiple property names/paths and their corresponding order directions. * * @template T The type of elements in the array * @param {ArrayLike | null | undefined} collection The array to sort * @param {Many>} iteratees The property names/paths to sort by * @param {Many} orders The sort orders * @returns {T[]} Returns the new sorted array * @example * const users = [ * { name: 'fred', age: 48 }, * { name: 'barney', age: 34 } * ]; * * // Sort by name in ascending order * orderBy(users, ['name'], ['asc']); * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] */ declare function orderBy(collection: ArrayLike | null | undefined, iteratees?: Many>, orders?: Many): T[]; /** * Sorts an object's values based on multiple iteratee functions and their corresponding order directions. * * @template T The object type * @param {T | null | undefined} collection The object to sort values from * @param {Many>} iteratees The iteratee functions to sort by * @param {Many} orders The sort orders * @returns {Array} Returns the new sorted array * @example * const obj = { * a: { name: 'fred', age: 48 }, * b: { name: 'barney', age: 34 } * }; * * // Sort by age in ascending order * orderBy(obj, [(user) => user.age], ['asc']); * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] */ declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; /** * Sorts an object's values based on multiple property names/paths and their corresponding order directions. * * @template T The object type * @param {T | null | undefined} collection The object to sort values from * @param {Many>} iteratees The property names/paths to sort by * @param {Many} orders The sort orders * @returns {Array} Returns the new sorted array * @example * const obj = { * a: { name: 'fred', age: 48 }, * b: { name: 'barney', age: 34 } * }; * * // Sort by name in ascending order * orderBy(obj, ['name'], ['asc']); * // => [{ name: 'barney', age: 34 }, { name: 'fred', age: 48 }] */ declare function orderBy(collection: T | null | undefined, iteratees?: Many>, orders?: Many): Array; //#endregion export { orderBy };