Returns true if the given array and its elements in the selected index range (entire array, by default) are in the order defined by the given comparator ({@link @thi.ng/compare#compare} by default).
remarks
Always returns true, if effective index range (or array length) has less than two elements. No bounds checking.
example
isSorted([3, 2, 1])
// false// w/ custom comparator
isSorted([3, 2, 1], (a, b) => b - a)
// true
Returns true if the given array and its elements in the selected index range (entire array, by default) are in the order defined by the given comparator ({@link @thi.ng/compare#compare} by default).
Always returns true, if effective index range (or array length) has less than two elements. No bounds checking.
isSorted([3, 2, 1]) // false // w/ custom comparator isSorted([3, 2, 1], (a, b) => b - a) // true