object/assign.js

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