/** * Operations for sorting collections. * * @remarks * NOTE: Prior to Node 11.x, the `Array.sort()` algorithm is not guaranteed to be stable. For maximum * compatibility, consider using {@link LegacyAdapters.sortStable} instead of `Array.sort()`. * * @public */ export declare class Sort { /** * Compares `x` and `y` using the JavaScript `>` and `<` operators. This function is suitable for usage as * the callback for `array.sort()`. * * @remarks * * The JavaScript ordering is generalized so that `undefined` \< `null` \< all other values. * * @returns -1 if `x` is smaller than `y`, 1 if `x` is greater than `y`, or 0 if the values are equal. * * @example * * ```ts * let array: number[] = [3, 6, 2]; * array.sort(Sort.compareByValue); // [2, 3, 6] * ``` */ static compareByValue(x: any, y: any): number; /** * Sorts the array according to a key which is obtained from the array elements. * The result is guaranteed to be a stable sort. * * @example * * ```ts * let array: string[] = [ 'aaa', 'bb', 'c' ]; * Sort.sortBy(array, x => x.length); // [ 'c', 'bb', 'aaa' ] * ``` */ static sortBy(array: T[], keySelector: (element: T) => any, comparer?: (x: any, y: any) => number): void; /** * Returns true if the array is already sorted. */ static isSorted(array: T[], comparer?: (x: any, y: any) => number): boolean; /** * Returns true if the array is already sorted by the specified key. * * @example * * ```ts * let array: string[] = [ 'a', 'bb', 'ccc' ]; * Sort.isSortedBy(array, x => x.length); // true * ``` */ static isSortedBy(array: T[], keySelector: (element: T) => any, comparer?: (x: any, y: any) => number): boolean; /** * Sorts the entries in a Map object according to the map keys. * The result is guaranteed to be a stable sort. * * @example * * ```ts * let map: Map = new Map(); * map.set('zebra', 1); * map.set('goose', 2); * map.set('aardvark', 3); * Sort.sortMapKeys(map); * console.log(JSON.stringify(Array.from(map.keys()))); // ["aardvark","goose","zebra"] * ``` */ static sortMapKeys(map: Map, keyComparer?: (x: K, y: K) => number): void; /** * Sorts the entries in a Set object according to the specified keys. * The result is guaranteed to be a stable sort. * * @example * * ```ts * let set: Set = new Set(); * set.add('aaa'); * set.add('bb'); * set.add('c'); * Sort.sortSetBy(set, x => x.length); * console.log(Array.from(set)); // ['c', 'bb', 'aaa'] * ``` */ static sortSetBy(set: Set, keySelector: (element: T) => any, keyComparer?: (x: T, y: T) => number): void; /** * Sorts the entries in a Set object. The result is guaranteed to be a stable sort. * * @example * * ```ts * let set: Set = new Set(); * set.add('zebra'); * set.add('goose'); * set.add('aardvark'); * Sort.sortSet(set); * console.log(Array.from(set)); // ['aardvark', 'goose', 'zebra'] * ``` */ static sortSet(set: Set, comparer?: (x: T, y: T) => number): void; } //# sourceMappingURL=Sort.d.ts.map