function prepareSortingOptimization(storages, simplifiedOrderFieldPaths) {
  let idb = idbProvider()
  for (let [keyPath, storageAndScore] of storages) {
    let keyPathSlice = keyPath.slice(0, simplifiedOrderFieldPaths.length)
    if (idb.cmp(keyPathSlice, simplifiedOrderFieldPaths) === 0) {
      storageAndScore.score += 4 // optimizing the sorting is more important
    }
  }
}
function prepareSortingOptimization(storages, simplifiedOrderFieldPaths) {
  let idb = idbProvider()
  for (let [keyPath, storageAndScore] of storages) {
    let keyPathSlice = keyPath.slice(0, simplifiedOrderFieldPaths.length)
    if (idb.cmp(keyPathSlice, simplifiedOrderFieldPaths) === 0) {
      storageAndScore.score += 4 // optimizing the sorting is more important
    }
  }
}
function prepareSortingOptimization ( storages , simplifiedOrderFieldPaths ) { let idb = idbProvider ( ) for ( let [ keyPath , storageAndScore ] of storages ) { let keyPathSlice = keyPath . slice ( 0 , simplifiedOrderFieldPaths . length ) if ( idb . cmp ( keyPathSlice , simplifiedOrderFieldPaths ) === 0 ) { storageAndScore . score += 4 // optimizing the sorting is more important } } }
Calculates the best possible sorting optimization for the provided storages,
updating the provided map with sorting optimization scores for each storage.

@param {Map<string[], {storage: AbstractReadOnlyStorage, score: number, keyRange: (undefined|IDBKeyRange), filter: ?function(*, (number|string|Date|Array)): boolean}>} storages
Map of storage key paths to storages and information related to how
the query would be executed on each of them, including the
performance optimization score (the higher is better).
@param {string[]} simplifiedOrderFieldPaths Ordering field paths with the
exclamation mark prefix stripped from them.
Calculates the best possible sorting optimization for the provided storages updating the provided map with sorting optimization scores for each storage .