function compareIndexMap(indexMap, itemA, itemB) {
    var indexA = indexMap[itemA._id];
    var indexB = indexMap[itemB._id];
    return indexA - indexB;
  }
Sort comparer function for items' index map.

@param {Object} indexMap
@param {Item} itemA
@param {Item} itemB
@returns {Number}