repeat-string
Advanced tools
Comparing version 0.2.1 to 0.2.2
20
index.js
@@ -10,3 +10,3 @@ /*! | ||
module.exports = function repeat(str, num) { | ||
module.exports = function repeat(str, count) { | ||
if (typeof str !== 'string') { | ||
@@ -16,9 +16,15 @@ throw new TypeError('repeat-string expects a string.'); | ||
var res = ''; | ||
if (count < 1) { | ||
return ''; | ||
} | ||
while (num--) { | ||
res += str; | ||
var result = ''; | ||
while (count > 0) { | ||
if (count & 1) { | ||
result += str; | ||
} | ||
count >>= 1; | ||
str += str; | ||
} | ||
return res; | ||
}; | ||
return result; | ||
}; |
{ | ||
"name": "repeat-string", | ||
"description": "Repeat the given string, n times.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/jonschlinkert/repeat-string", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9173
64