import type { Comparator } from "@thi.ng/api" ; import { compare } from "@thi.ng/compare/compare" ; /**
 * 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 example param arr param cmp param start param end export const isSorted = < T > ( arr , cmp = compare , start = 0 , end = arr . length ) => { let prev = arr [ start ] ; while ( ++ start < end ) { const curr = arr [ start ] ; if ( cmp ( prev , curr ) > 0 ) return false ; prev = curr ; } return true ; } ;