]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/string/#/repeat/shim.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / string / # / repeat / shim.js
1 // Thanks: http://www.2ality.com/2014/01/efficient-string-repeat.html
2
3 'use strict';
4
5 var value     = require('../../../object/valid-value')
6   , toInteger = require('../../../number/to-integer');
7
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 < ∞");
13         result = '';
14         if (!count) return result;
15         while (true) {
16                 if (count & 1) result += str;
17                 count >>>= 1;
18                 if (count <= 0) break;
19                 str += str;
20         }
21         return result;
22 };