simplify.js
function heapUp(i) {
    var w = heapWeight(i)
    while(i > 0) {
      var parent = heapParent(i)
      if(parent >= 0) {
        var pw = heapWeight(parent)
        if(w < pw) {
          heapSwap(i, parent)
          i = parent
          continue
        }
      }
      return i
    }
  }
function heapUp(i) {
    var w = heapWeight(i)
    while(i > 0) {
      var parent = heapParent(i)
      if(parent >= 0) {
        var pw = heapWeight(parent)
        if(w < pw) {
          heapSwap(i, parent)
          i = parent
          continue
        }
      }
      return i
    }
  }
function heapUp ( i ) { var w = heapWeight ( i ) while ( i > 0 ) { var parent = heapParent ( i ) if ( parent >= 0 ) { var pw = heapWeight ( parent ) if ( w < pw ) { heapSwap ( i , parent ) i = parent continue } } return i } }
Bubbles element i up the heap
Bubbles element i up the heap