String.prototype.padLeft / String.prototype.padRight

Bergi a.d.bergi at
Wed Nov 18 00:54:17 UTC 2015

Coroutines schrieb:

> I disagree with what has been decided. :p
> I was in favor of {trim,pad}{Right,Left}().  The reason: Iterators.
> As JS moves forward toward people creating iterators to traverse an
> object, referring to the start and end of something *can* be
> ambiguous.  There is no confusion with *Left() or *Right().

I could not disagree more with that. Iterators don't have a "left" or 
"right" side, they have a start and an end? The former would be much 
more confusing.
So when you `padStart` or `trimStart` an iterator you can be sure it 
will always put something in front of it or cut something at the 
beginning, regardless whether your iterator does iterate your array or 
structure backwards (right-to-left?), from left to right, top-down, 
bottom-up, or whatever direction you've drawn/imagined it in.


More information about the es-discuss mailing list