string/concat.js

  1. import { convertStringMethod } from './convertStringMethod'
  2. /**
  3. * Replaces by former string concatenated with <code>strings</code>.<br/>
  4. * ⚠ Due to name conflicts, this function is named <code>stringConcat</code> when imported from top level (<code>import { stringConcat } from 'immutadot'</code>).
  5. * @function
  6. * @memberof string
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @param {...string} strings Strings to concatenate.
  10. * @return {Object} Returns the updated object.
  11. * @example concat({ nested: { a: 'Hello' } }, 'nested.a', ' world', ' !') // => { nested: { a: 'Hello world !' } }
  12. * @see {@link https://mdn.io/String.prototype.concat|String.prototype.concat} for more information.
  13. * @since 1.0.0
  14. */
  15. const concat = convertStringMethod('concat')
  16. export { concat }