1/* eslint-disable */ 2/** 3 * Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat 4 * 5 * This should maybe be moved to the jspolyfill-plugin 6 */ 7if (!String.prototype.repeat) { 8 String.prototype.repeat = function (count) { 9 'use strict'; 10 if (this == null) { 11 throw new TypeError('can\'t convert ' + this + ' to object'); 12 } 13 var str = '' + this; 14 count = +count; 15 if (count != count) { 16 count = 0; 17 } 18 if (count < 0) { 19 throw new RangeError('repeat count must be non-negative'); 20 } 21 if (count == Infinity) { 22 throw new RangeError('repeat count must be less than infinity'); 23 } 24 count = Math.floor(count); 25 if (str.length == 0 || count == 0) { 26 return ''; 27 } 28 // Ensuring count is a 31-bit integer allows us to heavily optimize the 29 // main part. But anyway, most current (August 2014) browsers can't handle 30 // strings 1 << 28 chars or longer, so: 31 if (str.length * count >= 1 << 28) { 32 throw new RangeError('repeat count must not overflow maximum string size'); 33 } 34 var rpt = ''; 35 for (var i = 0; i < count; i++) { 36 rpt += str; 37 } 38 return rpt; 39 } 40} 41