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

Avoid String.repeat #182

Closed daurnimator closed 5 years ago

daurnimator commented 5 years ago

String.repeat is not implemented in older browsers.

https://github.com/alexei/sprintf.js/blob/ceb9b805e6d594a9c24cdde02890d3c00c6643b7/src/sprintf.js#L134

alexei commented 5 years ago

Yes, see https://github.com/alexei/sprintf.js#browser

daurnimator commented 5 years ago

I'm using your library in a context where I can't modify the global environment. Is there some way I could pass repeat in? Alternatively it would be great if you could include a compatibility shim. https://github.com/zloirock/core-js/blob/7586b39efdb16e81a8e54e4d780f402456b3fd4a/packages/core-js/internals/string-repeat.js#L12 seems like a good one.