Skip to content

A proposal to the ECMAScript standard for including left and right trim of whitespace to strings

Notifications You must be signed in to change notification settings

Eschon/ecmascript-string-left-right-trim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

trimLeft and trimRight for ECMAScript

ES5 standardized String.prototype.trim. All major engines have also implemented corresponding String.prototype.trimLeft and String.prototype.trimRight functions - without any standard specification.

Since these are defacto standard across engines, I propose that these are standardized as is.

Bidi and Right-to-Left Strings

In this discussion it was noted that the words left and right doesn't make sense for bidirectional and right-to-left languages. A more appropriately name for these functions would be trimStart and trimEnd which corresponds to the existing startsWith and endsWith.

Unfortunately, all engines already implement them and removing them would likely break the web.

See this extension to the spec.

It is my intention to propose this as a Stage 0 proposal to the next version of ECMAScript.

About

A proposal to the ECMAScript standard for including left and right trim of whitespace to strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published