`String.prototype.trimStart`/`String.prototype.trimEnd` with a given string

Jacob Pratt jhprattdev at gmail.com
Sun Jun 23 07:13:49 UTC 2019


`String.prototype.padStart` and `String.prototype.padEnd` accept the string
to pad with as their final parameter. Is there any particular reason
`String.prototype.trimStart` and `String.prototype.trimEnd` don't do the
same? It would be nice to have a parallel, such that `'foo'.padEnd(10,
'bar').trimEnd('bar') === 'foo'`.

References:
- https://github.com/tc39/proposal-string-pad-start-end
- https://github.com/tc39/proposal-string-left-right-trim

Jacob Pratt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190623/87885705/attachment.html>


More information about the es-discuss mailing list