code: function compareIndex(nodeA, nodeB) {
    var indexA = nodeA && nodeA.sortIndex;
    var indexB = nodeB && nodeB.sortIndex;
    if (!indexA && !indexB) {
      return 0;
    }
    else if (Boolean(indexA) !== Boolean(indexB)) {
      return indexA ? +1 : indexB ? -1 : 0;
    }
    else {
      return indexA - indexB;
    }
  }
docs: Compare function for nodes with sort-index.
  @param {object} nodeA First node
  @param {object} nodeB Second node
  @returns {number} -1 where a follows b, +1 where b follows a, 0 otherwise