New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String.prototype.trimStart/trimEnd (or trimLeft/trimRight) #514

Closed
evilpie opened this Issue Apr 2, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@evilpie
Contributor

evilpie commented Apr 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?

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

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.

Member

ljharb commented Apr 2, 2016

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.

@evilpie

This comment has been minimized.

Show comment
Hide comment
@evilpie

evilpie Apr 2, 2016

Contributor

This is now a pull request tc39/proposal-string-left-right-trim#6. We also settled on option 2.

Contributor

evilpie commented Apr 2, 2016

This is now a pull request tc39/proposal-string-left-right-trim#6. We also settled on option 2.

@bterlson bterlson closed this Apr 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment