Use baseToString in _.repeat.

This commit is contained in:
John-David Dalton
2015-01-17 20:15:11 -08:00
committed by jdalton
parent d4bcd4ab0c
commit a9a95de02d

View File

@@ -9603,13 +9603,11 @@
*/
function repeat(string, n) {
var result = '';
string = baseToString(string);
n = +n;
if (n < 1 || string == null || !nativeIsFinite(n)) {
if (n < 1 || !string || !nativeIsFinite(n)) {
return result;
}
string = (string + '');
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See http://en.wikipedia.org/wiki/Exponentiation_by_squaring.
do {