Home > @microsoft/node-core-library > Sort

Sort class

Operations for sorting collections.

Signature:

export declare class Sort 

Methods

Method Modifiers Description
compareByValue(x, y) static Compares x and y using the JavaScript > and < operators. This function is suitable for usage as the callback for array.sort().
isSorted(array, comparer) static Returns true if the array is already sorted.
isSortedBy(array, keySelector, comparer) static Returns true if the array is already sorted by the specified key.
sortBy(array, keySelector, comparer) static Sorts the array according to a key which is obtained from the array elements.
sortMapKeys(map, keyComparer) static Sorts the entries in a Map object according to the keys.
sortSet(set, comparer) static Sorts the entries in a Set object according to the keys.
sortSetBy(set, keySelector, keyComparer) static Sorts the entries in a Set object according to the keys.