es2015/migration/RecordFetcher.js
function fetchAllRecords(transaction, objectStores) {
  return PromiseSync.all(objectStores.map((descriptor) => {
    return fetchRecords(
      transaction.getObjectStore(descriptor.objectStore),
      descriptor.preprocessor
    )
  })).then((fetchedRecords) => {
    let recordsMap = {}
    
    for (let i = 0; i < objectStores.length; i++) {
      recordsMap[objectStores[i].objectStore] = fetchedRecords[i]
    }
    
    return recordsMap
  })
}
function fetchAllRecords(transaction, objectStores) {
  return PromiseSync.all(objectStores.map((descriptor) => {
    return fetchRecords(
      transaction.getObjectStore(descriptor.objectStore),
      descriptor.preprocessor
    )
  })).then((fetchedRecords) => {
    let recordsMap = {}
    
    for (let i = 0; i < objectStores.length; i++) {
      recordsMap[objectStores[i].objectStore] = fetchedRecords[i]
    }
    
    return recordsMap
  })
}
Fetches all records from the specified object stores using the provided
read-write transaction.

@param {Transaction} transaction The read-write transaction to use to access
the object stores.
@param {(string|{objectStore: string, preprocessor: function(*, (number|string|Date|Array)): (*|UpgradedDatabaseSchema.SKIP_RECORD|UpgradedDatabaseSchema.DELETE_RECORD)=})[]} objectStores
The names of object stores that should have their records fetch or
(possibly partially filled) object store fetch descriptors, mixed in
an array.
@return {PromiseSync<Object<string, {key: (number|string|Date|Array), record: *}[]>>}
A promise that resolves once all the records have been fetched and
the records marked for deletion were deleted.
The promise resolves to a map of object store names to the records
fetched from the object store, except for the records marked for
skipping or deletion.