string/trimStart.js

  1. import { applyStringMethod } from './applyStringMethod'
  2. /**
  3. * Replaces by former string stripped of whitespaces at start.
  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 trimStart({ nested: { a: ' Hello world ! ' } }) // => { nested: { a: 'Hello world ! ' } }
  10. * @see {@link https://mdn.io/String.prototype.trimStart|String.prototype.trimStart} for more information.
  11. * @since 1.0.0
  12. */
  13. const trimStart = applyStringMethod(String.prototype.trimStart, { fixedArity: true })
  14. export { trimStart, trimStart as trimLeft }