string/trimEnd.js

  1. import { applyStringMethod } from './applyStringMethod'
  2. /**
  3. * Replaces by former string stripped of whitespaces at end.
  4. * @function
  5. * @memberof string
  6. * @param {Object} object The object to modify.
  7. * @param {Array|string} path The path of the property to set.
  8. * @return {Object} Returns the updated object.
  9. * @example trimEnd({ nested: { a: ' Hello world ! ' } }) // => { nested: { a: ' Hello world !' } }
  10. * @see {@link https://mdn.io/String.prototype.trimEnd|String.prototype.trimEnd} for more information.
  11. * @since 1.0.0
  12. */
  13. const trimEnd = applyStringMethod(String.prototype.trimEnd, { fixedArity: true })
  14. export { trimEnd, trimEnd as trimRight }