src/reducer.js
function changeNestedFormValue ({bunsenId, formValue, model, value}) {
  const segments = bunsenId.split('.')
  const lastSegment = segments.pop()
  const isEmpty = _.isEmpty(value) && (Array.isArray(value) || _.isObject(value)) && !(value instanceof File)

  // Make sure form value is immutable
  formValue = immutableOnce(formValue)

  if (isArrayItem(lastSegment)) {
    return setProperty({bunsenId, formValue, value})
  }

  if (_.includes([null, undefined, ''], value) || isEmpty) {
    return unsetProperty({bunsenId, formValue, value})
  }

  if (!_.isEqual(value, _.get(formValue, bunsenId))) {
    return setProperty({bunsenId, formValue, value})
  }

  return {
    value: formValue,
    valueChangeSet: new Map()
  }
}
function changeNestedFormValue ({bunsenId, formValue, model, value}) {
  const segments = bunsenId.split('.')
  const lastSegment = segments.pop()
  const isEmpty = _.isEmpty(value) && (Array.isArray(value) || _.isObject(value)) && !(value instanceof File)

  // Make sure form value is immutable
  formValue = immutableOnce(formValue)

  if (isArrayItem(lastSegment)) {
    return setProperty({bunsenId, formValue, value})
  }

  if (_.includes([null, undefined, ''], value) || isEmpty) {
    return unsetProperty({bunsenId, formValue, value})
  }

  if (!_.isEqual(value, _.get(formValue, bunsenId))) {
    return setProperty({bunsenId, formValue, value})
  }

  return {
    value: formValue,
    valueChangeSet: new Map()
  }
}
function changeNestedFormValue ( { bunsenId , formValue , model , value } ) { const segments = bunsenId . split ( '.' ) const lastSegment = segments . pop ( ) const isEmpty = _ . isEmpty ( value ) && ( Array . isArray ( value ) || _ . isObject ( value ) ) && ! ( value instanceof File ) // Make sure form value is immutable formValue = immutableOnce ( formValue ) if ( isArrayItem ( lastSegment ) ) { return setProperty ( { bunsenId , formValue , value } ) } if ( _ . includes ( [ null , undefined , '' ] , value ) || isEmpty ) { return unsetProperty ( { bunsenId , formValue , value } ) } if ( ! _ . isEqual ( value , _ . get ( formValue , bunsenId ) ) ) { return setProperty ( { bunsenId , formValue , value } ) } return { value : formValue , valueChangeSet : new Map ( ) } }
Change value of form at specified path
@param {String} bunsenId - path to part of form to change value of
@param {Object} formValue - current form value
@param {BunsenMOdel} model - model
@param {Object} value - new value for path
@returns {Object} new state with value and value changeset
 /* eslint-disable complexity
Change value of form at specified path