@froalacharts/datatable
Version:
In memory tabular data storage
1 lines • 620 B
JavaScript
;exports.__esModule=true;exports["default"]=void 0;var _default=function _default(arr,_comparer,_direction,lo,hi){var direction=_direction,comparer=_comparer,isArrSorted;if(arr.constructor!==Array){throw new TypeError("This function can be applied only on array")}direction=direction||0;lo=lo||0;hi=hi||arr.length;if(!comparer){comparer=function comparer(a,b){return a-b}}isArrSorted=true;for(var i=1;i<arr.length;i++){if(direction===0){if(comparer(arr[i-1],arr[i])>=1){isArrSorted=false;break}}else{if(comparer(arr[i-1],arr[i])<=-1){isArrSorted=false;break}}}return isArrSorted};exports["default"]=_default;