Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/ab-connector / src / state / index.js
Size: Mime:
export const initialState = {
  experiments: {},
  optimize: {},
};

/**
 * Creates an initial state object containing the ab state
 *
 * @param {Object} options
 * @param {string} options.domain For mounting this state under a different key in redux. Default: `ab`.
 * @param {Object} options.initialState override the initial state
 *
 * @example
 * import { createState as createAbState } from '@doodle/ab-connector';
 *
 * const initialState = {
 *   ...createAbState(), // providing the state under the `domain` key
 * };
 * const store = createStore(rootReducer, initialState, enhancers);
 */
const createState = (options = {}) => ({
  [options.domain || 'ab']: options.initialState || Object.assign({}, initialState),
});

export default createState;