<commit_before>/**
@license
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

/*
  If you are lazy loading any connected elements, then these elements must be
  able to lazily install their reducers. This is a store enhancer that
  enables that.

  Sample use (where you define your redux store, in store.js):

  import lazyReducerEnhancer from '../node_modules/pwa-helpers/lazy-reducer-enhancer.js';
  import someReducer from './reducers/someReducer.js';

  export const store = createStore(
    (state, action) => state,
    compose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
  );

  Then, in your page/element, you can lazy load a specific reducer with:
  store.addReducers({
    someReducer
  });
*/
export const lazyReducerEnhancer = function(combineReducers) {
  return (nextCreator) => {
    return (origReducer, preloadedState) => {
      let lazyReducers = {};
      const nextStore = nextCreator(origReducer, preloadedState);
      return {
        ...nextStore,
        addReducers(newReducers) {
          this.replaceReducer(combineReducers(lazyReducers = {
            ...lazyReducers,
            ...newReducers
          }));
        }
      }
    }
  }
}
<commit_msg>remove object spread<commit_after>/**
@license
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/

/*
  If you are lazy loading any connected elements, then these elements must be
  able to lazily install their reducers. This is a store enhancer that
  enables that.

  Sample use (where you define your redux store, in store.js):

  import lazyReducerEnhancer from '../node_modules/pwa-helpers/lazy-reducer-enhancer.js';
  import someReducer from './reducers/someReducer.js';

  export const store = createStore(
    (state, action) => state,
    compose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
  );

  Then, in your page/element, you can lazy load a specific reducer with:
  store.addReducers({
    someReducer
  });
*/

export const lazyReducerEnhancer = function(combineReducers) {
  return (nextCreator) => {
    return (origReducer, preloadedState) => {
      let lazyReducers = {};
      const nextStore = nextCreator(origReducer, preloadedState)
      function addReducers(newReducers) {
        this.replaceReducer(combineReducers(lazyReducers =
          Object.assign({}, lazyReducers, newReducers)
        ));
      };
      return Object.assign({}, nextStore, {addReducers});
    }
  }
}

{'fraction_non_alphanumeric': 0.09211318482841661, 'fraction_numerical': 0.002408187838651415, 'mean_word_length': 3.552054794520548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4478057', 'n_tokens_mistral': 1017, 'n_tokens_neox': 969, 'n_words': 320}