function consume(ArrayClass, compare, heap, size) {
  var l = size,
      i = l;

  var array = new ArrayClass(size),
      lastItem,
      item;

  while (i > 0) {
    lastItem = heap[--i];

    if (i !== 0) {
      item = heap[0];
      heap[0] = lastItem;
      siftUp(compare, heap, --size, 0);
      lastItem = item;
    }

    array[i] = lastItem;
  }

  return array;
}
Fully consumes the given heap.

@param  {function} ArrayClass - Array class to use.
@param  {function} compare    - Comparison function.
@param  {array}    heap       - Array storing the heap's data.
@param  {number}   size       - True size of the heap.
@return {array}