source: trip-planner-front/node_modules/core-js/internals/string-repeat.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 612 bytes
Line 
1'use strict';
2var toInteger = require('../internals/to-integer');
3var toString = require('../internals/to-string');
4var requireObjectCoercible = require('../internals/require-object-coercible');
5
6// `String.prototype.repeat` method implementation
7// https://tc39.es/ecma262/#sec-string.prototype.repeat
8module.exports = function repeat(count) {
9 var str = toString(requireObjectCoercible(this));
10 var result = '';
11 var n = toInteger(count);
12 if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions');
13 for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str;
14 return result;
15};
Note: See TracBrowser for help on using the repository browser.