object/assign.js

  1. import _assign from 'lodash/assign'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces by an object assigning own enumerable string keyed properties of source objects to the destination object.<br />
  5. * Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.
  6. * @function
  7. * @memberof object
  8. * @param {Object} object The object to modify.
  9. * @param {Array|string} path The path of the property to set.
  10. * @param {...Object} [sources] The source objects.
  11. * @return {Object} Returns the updated object.
  12. * @example assign({ nested: { a: 1, b: 2 } }, 'nested', { b: 3, c: 4 }) // => { nested: { a:1, b: 3, c: 4 } }
  13. * @see {@link https://lodash.com/docs#assign|lodash.assign} for more information.
  14. * @since 0.1.12
  15. */
  16. const assign = convert(_assign)
  17. export { assign, assign as default }