Version: 0.1.00.2.00.2.10.2.20.3.00.3.10.3.20.4.00.4.10.4.20.5.0-rc.10.5.00.5.10.5.20.6.00.6.10.7.00.8.00.8.10.8.20.9.00.9.10.9.20.10.01.0.0-rc.11.0.0-rc.21.0.0-rc.31.0.01.0.11.0.21.1.01.1.11.2.01.2.11.3.01.3.12.0.02.1.02.2.02.2.12.3.02.4.02.4.12.4.23.0.03.0.13.1.03.2.03.3.03.3.13.4.03.5.03.6.03.7.03.8.03.9.03.9.13.9.23.9.33.10.03.10.14.0.04.0.14.1.04.2.04.2.14.3.04.4.04.5.04.5.14.6.04.6.14.7.04.8.04.8.14.8.24.9.04.10.04.11.04.11.14.11.24.12.04.13.04.13.14.14.04.14.14.14.24.15.04.16.04.16.14.16.24.16.34.16.44.16.54.16.64.17.04.17.14.17.24.17.34.17.44.17.54.17.94.17.104.17.114.17.124.17.134.17.144.17.154.17.164.17.174.17.184.17.194.17.204.17.21
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor;
/**
* The base implementation of `_.repeat` which doesn't coerce arguments.
*
* @private
* @param {string} string The string to repeat.
* @param {number} n The number of times to repeat the string.
* @returns {string} Returns the repeated string.
*/
function baseRepeat(string, n) {
var result = '';
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
if (n % 2) {
result += string;
n = nativeFloor(n / 2);
if (n) {
string += string;
} while (n);
module.exports = baseRepeat;