packages/flux-capacitor/lib/combineReducers.js
function createDatabaseReducer (collectionReducer, collectionName) {
  return (database, event) => {
    const collection = database.collections[ collectionName ]

    if (!collection) {
      throw new Error(`Collection '${collectionName}' not known by database instance.`)
    }

    return collectionReducer(collection, event)
  }
}
function createDatabaseReducer (collectionReducer, collectionName) {
  return (database, event) => {
    const collection = database.collections[ collectionName ]

    if (!collection) {
      throw new Error(`Collection '${collectionName}' not known by database instance.`)
    }

    return collectionReducer(collection, event)
  }
}
function createDatabaseReducer ( collectionReducer , collectionName ) { return ( database , event ) => { const collection = database . collections [ collectionName ] if ( ! collection ) { throw new Error ( ` ${ collectionName } ` ) } return collectionReducer ( collection , event ) } }
Takes a collection reducer and turns it into a database reducer by binding it
to one of the database's collections.

@param {Function} collectionReducer    (Collection, Event) => Changeset
@param {string}   collectionName
@return {Function}                     (Database, Event) => Changeset
Takes a collection reducer and turns it into a database reducer by binding it to one of the database s collections .