]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/node_modules/grim/node_modules/emissary/node_modules/es6-weak-map/node_modules/es5-ext/string/#/repeat/shim.js
0a3928b2c0dd76363613b3220835a928f35c0853
1 // Thanks: http://www.2ality.com/2014/01/efficient-string-repeat.html
5 var value
= require('../../../object/valid-value')
6 , toInteger
= require('../../../number/to-integer');
8 module
.exports = function (count
) {
9 var str
= String(value(this)), result
;
10 count
= toInteger(count
);
11 if (count
< 0) throw new RangeError("Count must be >= 0");
12 if (!isFinite(count
)) throw new RangeError("Count must be < ∞");
14 if (!count
) return result
;
16 if (count
& 1) result
+= str
;
18 if (count
<= 0) break;