code: function alreadySorted(sortDirection, data, comparator) {
    var numRows = data.length;
    if (sortDirection === _SortDirection2.default.Ascending) {
      for (var i = 1; i < numRows; i++) {
        if (comparator(data[i - 1], data[i]) > 0) {
          return false;
        }
      }
      // check descending
    } else {
      for (var _i = 1; _i < numRows; _i++) {
        if (comparator(data[_i - 1], data[_i]) < 0) {
          return false;
        }
      }
    }
  
    return true;
  }
docs: Helper function to test if an array is already sorted
  
  @param {Boolean} sortDirection The direction to check if it is sorted in
  @param {Array} data The data to check
  @param {Function} comparator The comparator to use
  @return {Boolean} True if already sorted, false otherwise