Returns a function that sorts reverse numerically by value of `key`
511833
function sortFactory(key) {
  return function sortNumeric(a, b) {
    if (b[key] < a[key]) {
      return -1;
    }
    if (b[key] > a[key]) {
      return 1;
    }
    return 0;
  };
}
576482
function sort(o) {
    if (self.getType(o) === 'object') {
      return Object.keys(o).sort().map(function(key) {
        return { k: key, v: sort(o[key]) };
      });
    } 
    return o;
  }
649929
function reverseOfNumber(number) {
        if (isNumber(number)) {
            var stringNumber = numberToString(number) + '';
            return Number(stringNumber.split('').reverse().join(''));
        }
        else {
            return 0;
        }
    }
815587
def sort_nicely(l):
    """"""
    convert = lambda text: int(text) if text.isdigit() else text
    alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
    l.sort(key=alphanum_key)
713993
def sort_descending(self, key):
        

        row, col, tab = key

        scells = self.grid.code_array[:, col, tab]
        sorted_row_idxs = sorted(xrange(len(scells)), key=scells.__getitem__)
        sorted_row_idxs.reverse()

        self.replace_cells(key, sorted_row_idxs)

        self.grid.ForceRefresh()
692178
def sortby(self, ntd):
        """"""
        if 'reldepth' in self.grprobj.gosubdag.prt_attr['flds']:
            return [ntd.NS, -1*ntd.dcnt, ntd.reldepth]
        else:
            return [ntd.NS, -1*ntd.dcnt, ntd.depth]
846632
function reverse(input) {

  if(isString(input)) {
    return input.split('').reverse().join('');
  }

  return (isArray(input))
    ? input.slice().reverse()
    : input;
}
1269679
def sort_list_of_dicts(lst_of_dct, keys, reverse=False, **sort_args):
    

    if type(keys) != list:
        keys = [keys]
    # dcmdir = lst_of_dct[:]
    # lst_of_dct.sort(key=lambda x: [x[key] for key in keys], reverse=reverse, **sort_args)
    lst_of_dct.sort(key=lambda x: [((False, x[key]) if key in x else (True, 0)) for key in keys], reverse=reverse, **sort_args)
    return lst_of_dct
373563
def sort(self, *, key: Optional[Callable[[Any], Any]] = None, reverse: bool = False) -> None:
        
        return list.sort(self, key=self._sort_key(key), reverse=reverse)
955494
def sort_by_priority(iterable, reverse=False, default_priority=10):
    
    return sorted(iterable, reverse=reverse, key=lambda o: getattr(o, 'priority', default_priority))
253093
def nsorted(
    to_sort: Iterable[str],
    key: Optional[Callable[[str], Any]] = None
) -> List[str]:
    """"""
    if key is None:
        key_callback = _natural_keys
    else:
        def key_callback(text: str) -> List[Any]:
            return _natural_keys(key(text))  # type: ignore

    return sorted(to_sort, key=key_callback)
168576
function binarySearch (comparator, array, key) {
  var low = 0, high = array.length - 1, partition, compare;
  while (low <= high) {
    partition = Math.floor(low + (high - low) / 2);
    compare = comparator(key, array[partition]);
    if (compare < 0) high = partition - 1;
    else if (compare > 0) low = partition + 1;
    else return partition;
  }
  return low;
}
895258
async def sort(self, request, reverse=False):
        """"""
        return sorted(
            self.collection, key=lambda o: getattr(o, self.columns_sort, 0), reverse=reverse)
80962
def sorted_nicely(l):
    
    convert = lambda text: int(text) if text.isdigit() else text
    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
    return sorted(l, key = alphanum_key)
782178
def sorted_t(key=None, reverse=False):
    
    return Transformation(
        'sorted',
        lambda sequence: sorted(sequence, key=key, reverse=reverse),
        None
    )
377205
function sortCollectionByKey(col, isDESC) {
  col.sort(function(a, b) {
    return getKeyLen(a) - getKeyLen(b);
  });

  if (isDESC) col.reverse();

  return col;
}
500206
function sortedKeys(dictionary) {
  let keys = [];
  for (let key in dictionary) {
    keys.push(key);
  }
  return keys.sort();
}