You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 30, 2019. It is now read-only.
ECMAScript proposal, specs, tests, and reference implementation for String.prototype.trimStart/trimEnd (plus trimLeft/trimRight).
Stage 4
This proposal is complete and already merged into ECMA262 specification. See the specification text here.
Rationale
ES5 standardized String.prototype.trim. All major engines have also implemented corresponding trimLeft and trimRight functions - without any standard specification.
For consistency with padStart/padEnd we propose trimStart and trimEnd and trimLeft/trimRight as aliases required for web compatibility.
Specification
You can view the spec in ecmarkup or rendered as HTML.
Naming / Aliasing
For consistency with padStart/padEnd the standard functions will be trimStart and trimEnd, however for web compatilibity trimLeft will alias trimStart and trimRight will alias trimEnd. This means String.prototype.trimRight.name will change from "trimRight" to "trimEnd" in most engines. The spec author does not expect this to cause any breakage.