Comparing version 0.2.1 to 0.2.2
@@ -13,5 +13,10 @@ // Generate on https://codesandbox.io/s/lr4ynm652m | ||
} else { | ||
return Array.from(text).reduce((total, curr) => { | ||
return total + (widthTable[curr.charCodeAt()] || widthTable[64]) // "@" | ||
}, 0) | ||
let total = 0 | ||
let i = text.length | ||
let charCode = 0 | ||
while (i--) { | ||
charCode = text[i].charCodeAt() | ||
total += widthTable[charCode < 127 ? charCode : 64] // "@" for overflows | ||
} | ||
return total | ||
} | ||
@@ -18,0 +23,0 @@ } |
{ | ||
"name": "badgen", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Hand-crafted badge generator.", | ||
@@ -5,0 +5,0 @@ "author": "Amio <amio.cn@gmail.com>", |
@@ -5,4 +5,4 @@ # badgen [![npm-version][npm-badge]][npm-link] [![install size][pp-badge]][pp-link] | ||
- 🌀 No dependeny. | ||
- ⚡️ 200K+ ops on average. (see [benchamrks](#Benchmarks)) | ||
- 🌀 Zero dependeny | ||
- ⚡️ Fast (see [benchamrks](#benchmarks)) | ||
@@ -34,5 +34,5 @@ ## Usage | ||
```bash | ||
generate by short params x 420,831 ops/sec ±1.03% (87 runs sampled) | ||
generate by long params x 167,862 ops/sec ±1.21% (90 runs sampled) | ||
generate by full params x 245,303 ops/sec ±1.48% (92 runs sampled) | ||
generate by short params x 543,857 ops/sec ±0.98% (90 runs sampled) | ||
generate by long params x 512,747 ops/sec ±0.66% (91 runs sampled) | ||
generate by full params x 461,409 ops/sec ±0.78% (90 runs sampled) | ||
``` | ||
@@ -42,3 +42,3 @@ | ||
ISC @ Amio | ||
![ISC](https://badgen.now.sh/badge/license/ISC/blue) | ||
@@ -45,0 +45,0 @@ [npm-badge]: https://img.shields.io/npm/v/badgen.svg |
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
7993
7
92