String.prototype.repeat
polyfill
ES6 A robust & optimized ES3-compatible polyfill for the String.prototype.repeat
method in ECMAScript 6.
Other polyfills for String.prototype.repeat
are available:
- https://github.com/paulmillr/es6-shim/blob/d8c4ec246a15e7df55da60b7f9b745af84ca9021/es6-shim.js#L146-L154 by Paul Miller (
fails 8 testsnow passes all tests)
Installation
In a browser:
<script src="repeat.js"></script>
Via npm:
npm install string.prototype.repeat
Then, in Node.js:
require('string.prototype.repeat');
// On Windows and on Mac systems with default settings, case doesn’t matter,
// which allows you to do this instead:
require('String.prototype.repeat');
Author
Mathias Bynens |
License
This polyfill is available under the MIT license.