https://github.com/mathiasbynens/string.prototype.repeat
A robust & optimized ES3-compatible polyfill for the `String.prototype.repeat` method in ECMAScript 6.
https://github.com/mathiasbynens/string.prototype.repeat
Last synced: 6 months ago
JSON representation
A robust & optimized ES3-compatible polyfill for the `String.prototype.repeat` method in ECMAScript 6.
- Host: GitHub
- URL: https://github.com/mathiasbynens/string.prototype.repeat
- Owner: mathiasbynens
- License: mit
- Created: 2013-12-10T14:39:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-01-16T01:49:53.000Z (over 4 years ago)
- Last Synced: 2024-12-10T05:42:47.471Z (6 months ago)
- Language: JavaScript
- Homepage: https://mths.be/repeat
- Size: 16.6 KB
- Stars: 27
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT.txt
Awesome Lists containing this project
README
# ES6 `String.prototype.repeat` polyfill [](https://travis-ci.org/mathiasbynens/String.prototype.repeat)
A robust & optimized polyfill for [the `String.prototype.repeat` method in ECMAScript 6](http://ecma-international.org/ecma-262/6.0/#sec-string.prototype.repeat).
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-string.prototype.repeat).
Other polyfills for `String.prototype.repeat` are available:
* by [Paul Miller](http://paulmillr.com/) (~~[fails 8 tests](https://github.com/paulmillr/es6-shim/issues/164)~~ now passes all tests)
## Installation
Via [npm](https://www.npmjs.com/):
```bash
npm install string.prototype.repeat
```Then, in [Node.js](https://nodejs.org/):
```js
var repeat = require('string.prototype.repeat');
```In a browser:
```html
```
> **NOTE**: It's recommended that you install this module using a package manager
> such as `npm`, because loading multiple polyfills from a CDN (such as `bundle.run`)
> will lead to duplicated code.## Author
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|
| [Mathias Bynens](https://mathiasbynens.be/) |## License
This polyfill is available under the [MIT](https://mths.be/mit) license.