repeat-string
Advanced tools
Comparing version 1.3.0 to 1.4.0
12
index.js
@@ -40,9 +40,9 @@ /*! | ||
var max = str.length * num; | ||
cache = cache || str; | ||
if (cache !== str) { | ||
if (cache !== str || typeof cache === 'undefined') { | ||
cache = str; | ||
res = ''; | ||
cache = str; | ||
} | ||
while (num > 0 && max > res.length) { | ||
while (max > res.length && num > 0) { | ||
if (num & 1) { | ||
@@ -52,6 +52,2 @@ res += str; | ||
if (max <= res.length) { | ||
return res.substr(0, max); | ||
} | ||
num >>= 1; | ||
@@ -58,0 +54,0 @@ str += str; |
{ | ||
"name": "repeat-string", | ||
"description": "Repeat the given string n times. Fastest implementation for repeating a string.", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"homepage": "https://github.com/jonschlinkert/repeat-string", | ||
@@ -28,2 +28,3 @@ "author": { | ||
}, | ||
"files": ["index.js"], | ||
"devDependencies": { | ||
@@ -41,10 +42,8 @@ "benchmarked": "^0.1.3", | ||
"fill", | ||
"javascript", | ||
"js", | ||
"left", | ||
"left-pad", | ||
"multiple", | ||
"node.js", | ||
"pad", | ||
"padding", | ||
"repetition", | ||
"repeat", | ||
@@ -54,10 +53,5 @@ "repeating", | ||
"right-pad", | ||
"str", | ||
"string", | ||
"text", | ||
"times", | ||
"util", | ||
"utility", | ||
"utils" | ||
"times" | ||
] | ||
} |
@@ -41,17 +41,21 @@ # repeat-string [![NPM version](https://badge.fury.io/js/repeat-string.svg)](http://badge.fury.io/js/repeat-string) | ||
```bash | ||
#1: 2000x | ||
repeating.js x 6,547,013 ops/sec ±0.55% (97 runs sampled) | ||
repeat-string.js x 17,295,983 ops/sec ±0.86% (90 runs sampled) | ||
# 20,000x | ||
repeat-string.js x 16,619,408 ops/sec ±1.05% (92 runs sampled) | ||
repeating.js x 5,991,724 ops/sec ±0.62% (98 runs sampled) | ||
#2: 250x | ||
repeating.js x 7,043,588 ops/sec ±0.84% (97 runs sampled) | ||
repeat-string.js x 16,247,722 ops/sec ±0.63% (94 runs sampled) | ||
# 2,000x | ||
repeat-string.js x 17,284,768 ops/sec ±0.71% (94 runs sampled) | ||
repeating.js x 6,828,993 ops/sec ±0.87% (96 runs sampled) | ||
#3: 5x | ||
repeating.js x 11,895,182 ops/sec ±0.63% (99 runs sampled) | ||
repeat-string.js x 16,097,331 ops/sec ±0.67% (93 runs sampled) | ||
# 250x | ||
repeat-string.js x 16,241,986 ops/sec ±0.78% (93 runs sampled) | ||
repeating.js x 7,281,492 ops/sec ±0.76% (95 runs sampled) | ||
#4: 50x | ||
repeating.js x 9,572,600 ops/sec ±0.57% (99 runs sampled) | ||
repeat-string.js x 16,681,594 ops/sec ±0.78% (94 runs sampled) | ||
# 50x | ||
repeat-string.js x 16,447,301 ops/sec ±1.12% (96 runs sampled) | ||
repeating.js x 8,933,633 ops/sec ±0.64% (98 runs sampled) | ||
# 5x | ||
repeat-string.js x 16,363,515 ops/sec ±1.09% (98 runs sampled) | ||
repeating.js x 12,164,964 ops/sec ±0.74% (98 runs sampled) | ||
``` | ||
@@ -109,2 +113,2 @@ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 18, 2015._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 24, 2015._ |
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
112
5708
3
1
51