es2015/migration/ObjectStoreMigrator.js
function shouldDeleteIndex(objectStore, schema, indexName) {
  let schemaIndexes = schema.indexes || []
  let newIndexNames = schemaIndexes.map(indexSchema => indexSchema.name)

  if (newIndexNames.indexOf(indexName) === -1) {
    return true
  }

  let index = objectStore.index(indexName)
  let indexKeyPath = index.keyPath;
  if (indexKeyPath && (typeof indexKeyPath !== "string")) {
    indexKeyPath = Array.from(indexKeyPath)
  }
  let serializedIndexKeyPath = JSON.stringify(indexKeyPath)

  let indexSchema = schemaIndexes.filter((indexSchema) => {
    return indexSchema.name === index.name
  })[0]

  return (index.unique !== indexSchema.unique) ||
      (index.multiEntry !== indexSchema.multiEntry) ||
      (serializedIndexKeyPath !== JSON.stringify(indexSchema.keyPaths))
}
function shouldDeleteIndex(objectStore, schema, indexName) {
  let schemaIndexes = schema.indexes || []
  let newIndexNames = schemaIndexes.map(indexSchema => indexSchema.name)

  if (newIndexNames.indexOf(indexName) === -1) {
    return true
  }

  let index = objectStore.index(indexName)
  let indexKeyPath = index.keyPath;
  if (indexKeyPath && (typeof indexKeyPath !== "string")) {
    indexKeyPath = Array.from(indexKeyPath)
  }
  let serializedIndexKeyPath = JSON.stringify(indexKeyPath)

  let indexSchema = schemaIndexes.filter((indexSchema) => {
    return indexSchema.name === index.name
  })[0]

  return (index.unique !== indexSchema.unique) ||
      (index.multiEntry !== indexSchema.multiEntry) ||
      (serializedIndexKeyPath !== JSON.stringify(indexSchema.keyPaths))
}
Returns {@code true} if the index should be deleted from the object store,
whether because it is no longer present in the schema or its properties have
been updated in the schema.

@param {IDBObjectStore} objectStore The native Indexed DB object store.
@param {ObjectStoreSchema} schema The schema of the object store.
@param {string} indexName The name of the index being tested whether it
should be deleted.
@return {@code true} if the index should be deleted.