Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upString.prototype.trimStart/trimEnd (or trimLeft/trimRight) #514
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
ljharb
Apr 2, 2016
Member
I think @sebmarkbage is still championing this proposal - if you can make a pull request into his proposal repository, that would be the best place to discuss it.
|
I think @sebmarkbage is still championing this proposal - if you can make a pull request into his proposal repository, that would be the best place to discuss it. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
evilpie
Apr 2, 2016
Contributor
This is now a pull request tc39/proposal-string-left-right-trim#6. We also settled on option 2.
|
This is now a pull request tc39/proposal-string-left-right-trim#6. We also settled on option 2. |
bterlson
closed this
Apr 19, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
evilpie commentedApr 2, 2016
I refreshed @sebmarkbage's trimLeft/trimRight proposal: https://evilpie.github.io/ecmascript-string-left-right-trim/. trimStart/trimEnd are now the canonical function objects, which matches the newly introduced padStart/padEnd functions. The old non-standard trimLeft/trimRight functions simply alias those. For posterity sake there is a tiny backwards compatibility issue, String.prototype.trimLeft.name would be "trimStart" instead of "trimLeft" as it is now. I don't expect this to cause any issues.
I wrote up two different proposal, one where trim/trimStart/trimEnd duplicate all of the (albeit very short) code and one where those functions call an abstract operation
TrimString. I can't actually decide, which one I like more, but the later certainly follows DRY as noted by @ljharb.This is stage 1 proposal at the moment, so I assume I need somebody to champion this?