code: function reorder(aChildren, bChildren) {
  
      var bKeys = keyIndex(bChildren)
  
      if (!bKeys) {
          return bChildren
      }
  
      var aKeys = keyIndex(aChildren)
  
      if (!aKeys) {
          return bChildren
      }
  
      var bMatch = {}, aMatch = {}
  
      for (var key in bKeys) {
          bMatch[bKeys[key]] = aKeys[key]
      }
  
      for (var key in aKeys) {
          aMatch[aKeys[key]] = bKeys[key]
      }
  
      var aLen = aChildren.length
      var bLen = bChildren.length
      var len = aLen > bLen ? aLen : bLen
      var shuffle = []
      var freeIndex = 0
      var i = 0
      var moveIndex = 0
      var moves = {}
      var removes = moves.removes = {}
      var reverse = moves.reverse = {}
      var hasMoves = false
  
      while (freeIndex < len) {
          var move = aMatch[i]
          if (move !== undefined) {
              shuffle[i] = bChildren[move]
              if (move !== moveIndex) {
                  moves[move] = moveIndex
                  reverse[moveIndex] = move
                  hasMoves = true
              }
              moveIndex++
          } else if (i in aMatch) {
              shuffle[i] = undefined
              removes[i] = moveIndex++
              hasMoves = true
          } else {
              while (bMatch[freeIndex] !== undefined) {
                  freeIndex++
              }
  
              if (freeIndex < len) {
                  var freeChild = bChildren[freeIndex]
                  if (freeChild) {
                      shuffle[i] = freeChild
                      if (freeIndex !== moveIndex) {
                          hasMoves = true
                          moves[freeIndex] = moveIndex
                          reverse[moveIndex] = freeIndex
                      }
                      moveIndex++
                  }
                  freeIndex++
              }
          }
          i++
      }
  
      if (hasMoves) {
          shuffle.moves = moves
      }
  
      return shuffle
  }
docs: List diff, naive left to right reordering