<commit_before>import * as actionTypes from '../constants/actionTypes';
import * as _ from 'lodash';

// N.B. must not use undefined here or react thinks the input is uncontrolled; react recommends empty string
export const initialState = {
	fields: {
    location: {
			latitude: '',
			longitude: '',
			user_provided_coords: true
		},
		motion: {
			usegps: false
		},
		blockchain: {
			usebc: false
		},
		pattern: {
			usepattern: false
		},
	}
};

// responsible for merging the existing state (state) w/ the state that comes from the action (in action)
export default function(state, action) {

  switch (action.type) {
    case actionTypes.DEVICE_FORM_UPDATE:
      const { segment, fieldName, value } = action;
      return _.merge({}, state, {fields: {[segment]: {[fieldName]: value}}});

    case actionTypes.DEVICE_FORM_MULTI_UPDATE:
      return _.merge({}, state, action.updateObj);
    default:
			// b/c initialState has some keys that the persistent storage doesn't (on purpose), always merge the initial state w/ the incoming one
			return _.merge({}, initialState, state);
  }
}<commit_msg>use pattern in current build<commit_after>import * as actionTypes from '../constants/actionTypes';
import * as _ from 'lodash';

// N.B. must not use undefined here or react thinks the input is uncontrolled; react recommends empty string
export const initialState = {
	fields: {
    location: {
			latitude: '',
			longitude: '',
			user_provided_coords: true
		},
		motion: {
			usegps: false
		},
		blockchain: {
			usebc: false
		},
		pattern: {
			usepattern: true
		},
	}
};

// responsible for merging the existing state (state) w/ the state that comes from the action (in action)
export default function(state, action) {

  switch (action.type) {
    case actionTypes.DEVICE_FORM_UPDATE:
      const { segment, fieldName, value } = action;
      return _.merge({}, state, {fields: {[segment]: {[fieldName]: value}}});

    case actionTypes.DEVICE_FORM_MULTI_UPDATE:
      return _.merge({}, state, action.updateObj);
    default:
			// b/c initialState has some keys that the persistent storage doesn't (on purpose), always merge the initial state w/ the incoming one
			return _.merge({}, initialState, state);
  }
}
{'fraction_non_alphanumeric': 0.11548791405550582, 'fraction_numerical': 0.0, 'mean_word_length': 3.5334685598377282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6784873', 'n_tokens_mistral': 711, 'n_tokens_neox': 649, 'n_words': 230}