code: function sort(array, compare, swap) {
    var unsortedBelow = array.length;
    while (unsortedBelow !== 0) {
      var lastSwap = 0;
      for (var i = 1; i < unsortedBelow; i++) {
        if (compare(array, i - 1, i) > 0) {
          swap(array, i, i - 1);
          lastSwap = i;
        }
      }
      unsortedBelow = lastSwap;
    }
    return array;
  }
docs: Sorts an array using bubble sort.
  @param {Array} array The array to sort.
  @param {function} compare The compare function.
  @param {function} swap A function to call when the swap operation is
  performed. This can be used to listen in on internals of the algorithm.
  @returns The sorted array.