src/index.js
function createRootReducer (container, ...reducers) {
  return (state = {}, action = {}) => {
    const identifiers = ensureContainerStateIdentifiers(container)
    const domElement = container[$domElement]
    const template = getTemplateFromDomElement(domElement)
    const middleware = container[$middleware].entries()
    const isBody = domElement == document.body

    if (action.data) {
      state = extend(state, action.data)
    }

    /**
     * Loops over each pipe function
     * providing state and action values
     * given to use from redux.
     *
     * @private
     */

    const reducerSet = new Set([ ...reducers ])
    const reducerEntires = reducerSet.entries()
    reduce()
    function reduce () {
      const step = reducerEntires.next()
      const done = step.done
      const reducer = step.value ? step.value[1] : null
      if (done) return
      const newState = reducer(state, action)
      if (null != newState)
        state = newState
      reduce()
    }

    if ($UPDATE_ACTION == action.type) {

      /**
       * Loops over each middleware function
       * providing state and action values
       * given to use from redux.
       *
       * @private
       */

      void function next () {
        const step = middleware.next()
        const done = step.done
        const reducer = step.value ? step.value[0] : null
        if (done) return
        else if (null == reducer) next()
        else if (false === reducer(state, action)) return
        else next()
      }()

      container.define(state)

      if (!isBody && identifiers) {
        const parser = new Parser()
        const partial = new Template(template)
        const src = partial.render(container.state, container)
        const patch = parser.createPatch(src)
        patch(domElement)
      }
    }

    return state
  }
}
function createRootReducer (container, ...reducers) {
  return (state = {}, action = {}) => {
    const identifiers = ensureContainerStateIdentifiers(container)
    const domElement = container[$domElement]
    const template = getTemplateFromDomElement(domElement)
    const middleware = container[$middleware].entries()
    const isBody = domElement == document.body

    if (action.data) {
      state = extend(state, action.data)
    }

    /**
     * Loops over each pipe function
     * providing state and action values
     * given to use from redux.
     *
     * @private
     */

    const reducerSet = new Set([ ...reducers ])
    const reducerEntires = reducerSet.entries()
    reduce()
    function reduce () {
      const step = reducerEntires.next()
      const done = step.done
      const reducer = step.value ? step.value[1] : null
      if (done) return
      const newState = reducer(state, action)
      if (null != newState)
        state = newState
      reduce()
    }

    if ($UPDATE_ACTION == action.type) {

      /**
       * Loops over each middleware function
       * providing state and action values
       * given to use from redux.
       *
       * @private
       */

      void function next () {
        const step = middleware.next()
        const done = step.done
        const reducer = step.value ? step.value[0] : null
        if (done) return
        else if (null == reducer) next()
        else if (false === reducer(state, action)) return
        else next()
      }()

      container.define(state)

      if (!isBody && identifiers) {
        const parser = new Parser()
        const partial = new Template(template)
        const src = partial.render(container.state, container)
        const patch = parser.createPatch(src)
        patch(domElement)
      }
    }

    return state
  }
}
function createRootReducer ( container , ... reducers ) { return ( state = { } , action = { } ) => { const identifiers = ensureContainerStateIdentifiers ( container ) const domElement = container [ $domElement ] const template = getTemplateFromDomElement ( domElement ) const middleware = container [ $middleware ] . entries ( ) const isBody = domElement == document . body if ( action . data ) { state = extend ( state , action . data ) } /**
     * Loops over each pipe function
     * providing state and action values
     * given to use from redux.
     *
     * @private
     */ const reducerSet = new Set ( [ ... reducers ] ) const reducerEntires = reducerSet . entries ( ) reduce ( ) function reduce ( ) { const step = reducerEntires . next ( ) const done = step . done const reducer = step . value ? step . value [ 1 ] : null if ( done ) return const newState = reducer ( state , action ) if ( null != newState ) state = newState reduce ( ) } if ( $UPDATE_ACTION == action . type ) { /**
       * Loops over each middleware function
       * providing state and action values
       * given to use from redux.
       *
       * @private
       */ void function next ( ) { const step = middleware . next ( ) const done = step . done const reducer = step . value ? step . value [ 0 ] : null if ( done ) return else if ( null == reducer ) next ( ) else if ( false === reducer ( state , action ) ) return else next ( ) } ( ) container . define ( state ) if ( ! isBody && identifiers ) { const parser = new Parser ( ) const partial = new Template ( template ) const src = partial . render ( container . state , container ) const patch = parser . createPatch ( src ) patch ( domElement ) } } return state } }
Creates a root reducer for a Container
instance.

@private
@param {Container} container
@return {Function}
Creates a root reducer for a Container instance .