es2015/object-store/utils.js
function splitFilteringObject(filter, filterFieldPaths, storageKeyPath) {
  let fieldsToOptimize = {}
  let fieldsToCompile = {}

  filterFieldPaths.forEach((fieldPath) => {
    let value = getFieldValue(filter, fieldPath)
    if (storageKeyPath.indexOf(fieldPath) > -1) {
      setFieldValue(fieldsToOptimize, fieldPath, value)
    } else {
      setFieldValue(fieldsToCompile, fieldPath, value)
    }
  })

  return {
    fieldsToOptimize,
    fieldsToCompile
  }
}
function splitFilteringObject(filter, filterFieldPaths, storageKeyPath) {
  let fieldsToOptimize = {}
  let fieldsToCompile = {}

  filterFieldPaths.forEach((fieldPath) => {
    let value = getFieldValue(filter, fieldPath)
    if (storageKeyPath.indexOf(fieldPath) > -1) {
      setFieldValue(fieldsToOptimize, fieldPath, value)
    } else {
      setFieldValue(fieldsToCompile, fieldPath, value)
    }
  })

  return {
    fieldsToOptimize,
    fieldsToCompile
  }
}
Splits the provided filter object to two objects according the the provided
storage key path. This is used to separate a complex filter object into an
object optimizable into a key range and a simpler object that will be
compiled into a filter predicate function.

@param {Object<string, *>} filter Filtering object to split.
@param {string[]} filterFieldPaths All field paths in the filtering object.
@param {string[]} storageKeyPath The key path(s) of the storage for which
the filtering object is being split.
@return {{fieldsToOptimize: Object<string, *>, fieldsToCompile: Object<string, *>}}
The {@code fieldsToOptimize} filter object will contain only the
field paths specified in the {@code storageKeyPath}, while the
{@code fieldsToCompile} will contain the remaining field paths of
the source filter object.