array/concat.js

  1. import { convertArrayMethod } from './convertArrayMethod'
  2. /**
  3. * Replaces an array concatenating the former array with additional arrays and/or values.<br/>
  4. * ⚠ Due to name conflicts, this function is named <code>arrayConcat</code> when imported from top level (<code>import { arrayConcat } from 'immutadot'</code>).
  5. * @function
  6. * @memberof array
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @param {...Array} arrays The arrays to concatenate.
  10. * @return {Object} Returns the updated object.
  11. * @example concat({ nested: { prop: [1, 2] } }, 'nested.prop', [3, 4]) // => { nested: { prop: [1, 2, 3, 4] } }
  12. * @see {@link https://mdn.io/Array.prototype.concat|Array.prototype.concat} for more information.
  13. * @since 0.2.0
  14. */
  15. const concat = convertArrayMethod('concat', false)
  16. export { concat }