lib/update.js
function update(updates, object, ...args) {
  if (typeof updates === 'function') {
    return updates(object, ...args)
  }

  if (!isPlainObject(updates)) {
    return updates
  }

  const defaultedObject =
    typeof object === 'undefined' || object === null ? {} : object

  const resolvedUpdates = resolveUpdates(updates, defaultedObject)

  if (isEmpty(resolvedUpdates)) {
    return defaultedObject
  }

  if (Array.isArray(defaultedObject)) {
    return updateArray(resolvedUpdates, defaultedObject).filter(
      value => value !== innerOmitted
    )
  }

  return _omitBy(
    { ...defaultedObject, ...resolvedUpdates },
    value => value === innerOmitted
  )
}
function update(updates, object, ...args) {
  if (typeof updates === 'function') {
    return updates(object, ...args)
  }

  if (!isPlainObject(updates)) {
    return updates
  }

  const defaultedObject =
    typeof object === 'undefined' || object === null ? {} : object

  const resolvedUpdates = resolveUpdates(updates, defaultedObject)

  if (isEmpty(resolvedUpdates)) {
    return defaultedObject
  }

  if (Array.isArray(defaultedObject)) {
    return updateArray(resolvedUpdates, defaultedObject).filter(
      value => value !== innerOmitted
    )
  }

  return _omitBy(
    { ...defaultedObject, ...resolvedUpdates },
    value => value === innerOmitted
  )
}
function update ( updates , object , ... args ) { if ( typeof updates === 'function' ) { return updates ( object , ... args ) } if ( ! isPlainObject ( updates ) ) { return updates } const defaultedObject = typeof object === 'undefined' || object === null ? { } : object const resolvedUpdates = resolveUpdates ( updates , defaultedObject ) if ( isEmpty ( resolvedUpdates ) ) { return defaultedObject } if ( Array . isArray ( defaultedObject ) ) { return updateArray ( resolvedUpdates , defaultedObject ) . filter ( value => value !== innerOmitted ) } return _omitBy ( { ... defaultedObject , ... resolvedUpdates } , value => value === innerOmitted ) }
Recursively update an object or array.

Can update with values:
update({ foo: 3 }, { foo: 1, bar: 2 });
// => { foo: 3, bar: 2 }

Or with a function:
update({ foo: x => (x + 1) }, { foo: 2 });
// => { foo: 3 }

@function
@name update
@param {Object|Function} updates
@param {Object|Array}    object to update
@return {Object|Array}   new object with modifications
Recursively update an object or array .