alexei / sprintf.js

sprintf.js is a complete open source JavaScript sprintf implementation
BSD 3-Clause "New" or "Revised" License
2.11k stars 291 forks source link

Include String.prototype.repeat shim #183

Closed daurnimator closed 4 years ago

daurnimator commented 5 years ago

Solves #182

alexei commented 5 years ago

A custom String repeat implementation was shipped up until https://github.com/alexei/sprintf.js/pull/139 It's not going back into the library. Sorry!

aikar commented 5 years ago

With this being so tiny and not polluting String, what does it hurt to maintain it? Don't get me wrong, I want IE to go away as much as anyone else, but for a simple project that wanted to support IE11, not being able to use this library without polyfills is a major setback.

aikar commented 5 years ago

https://github.com/alexei/sprintf.js/issues/182#issuecomment-471540906 is also a great point.

Library authors are now no longer able to use this library if they support IE11.

aikar commented 5 years ago

That removal should of also been a SEMVER MAJOR break.

ashwalk33r commented 4 years ago

Instead of .repeat other means of achieving desired output can be used that are supported in IE11 - I see people prefer to do it like in https://github.com/fengari-lua/fengari/pull/149/commits/8cbc96e05bfdce0c074889fe526dc4e4b907bd45

In other hand String.repeat maybe a nice helper tool.

@alexei in https://github.com/alexei/sprintf.js/pull/183#issuecomment-473921746 do you mean that .repeat was introduced over custom String decorator? Do I take it as no for polyfills and no for decorators?

ashwalk33r commented 4 years ago

@daurnimator I don't get something - you create a custom function assigned to variable encapsulated properly and call it repeat.call(pad_character, pad_length) - what is this discussion with @alexei about? I agree with https://github.com/alexei/sprintf.js/pull/183#issuecomment-476250542

It's not a "function to mantain" - it is a reusable helper. @alexei do you want to have it used inline instead of being repeatable? What is "not requiring maintanance" solution that you wish for? Here you have it then https://github.com/alexei/sprintf.js/issues/192

ashwalk33r commented 4 years ago

Hey I've took my own spin on this matter https://github.com/alexei/sprintf.js/pull/193