string.prototype.repeat
Version:
A robust & optimized `String.prototype.repeat` polyfill, based on the ECMAScript 6 specification.
18 lines (11 loc) • 344 B
JavaScript
/*! https://mths.be/repeat v1.0.0 by @mathias */
;
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shimRepeat() {
var polyfill = getPolyfill();
if (String.prototype.repeat !== polyfill) {
define(String.prototype, { repeat: polyfill });
}
return polyfill;
};