es2015/object-store/utils.js
function partiallyOptimizeKeyPathMatchingFilter(filter, keyPath) {
  let keyRange = convertFieldMapToKeyRange(filter, keyPath)
  if (!keyRange) { // at least one of the values is a IDBKeyRange instance
    return {
      keyRange: undefined,
      filter: compileFieldRangeFilter(filter),
      score: 0
    }
  }

  return {
    keyRange,
    filter: null,
    score: 1
  }
}
function partiallyOptimizeKeyPathMatchingFilter(filter, keyPath) {
  let keyRange = convertFieldMapToKeyRange(filter, keyPath)
  if (!keyRange) { // at least one of the values is a IDBKeyRange instance
    return {
      keyRange: undefined,
      filter: compileFieldRangeFilter(filter),
      score: 0
    }
  }

  return {
    keyRange,
    filter: null,
    score: 1
  }
}
A sub-routine of the {@linkcode partiallyOptimizeFilter} used to generate
optimization result if the storage key path matches the field paths in the
filter object.

@param {Object<string, (number|string|Date|Array|IDBKeyRange)>} filter A map
of field names to expected values or key ranges representing the
expected values for those fields.
@param {string[]} keyPath The key path of the storage for which the filter
is to be optimized.
@return {{keyRange: IDBKeyRange, filter: ?function(*, (number|string|Date|Array)): boolean, score: number}}
The IndexedDB key range to use with the native API, additional
filtering predicate, and optimization score as a floating point
number within the range [0, 1]. The score is set to 1 if all filter
fields were converted to the key range, and the score is set to 0 if
none of the filter fields could have been converted to the key
range.