Comparing version 0.2.0 to 0.2.1
@@ -14,3 +14,3 @@ // Generate on https://codesandbox.io/s/lr4ynm652m | ||
return Array.from(text).reduce((total, curr) => { | ||
return total + widthTable[curr.charCodeAt()] || widthTable[64] // "@" | ||
return total + (widthTable[curr.charCodeAt()] || widthTable[64]) // "@" | ||
}, 0) | ||
@@ -17,0 +17,0 @@ } |
{ | ||
"name": "badgen", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Hand-crafted badge generator.", | ||
@@ -10,2 +10,3 @@ "author": "Amio <amio.cn@gmail.com>", | ||
"lint": "standard", | ||
"bench": "node bench/index.js", | ||
"test": "tap test/*.spec.js --reporter spec", | ||
@@ -17,4 +18,3 @@ "start": "node service.js", | ||
"devDependencies": { | ||
"find-my-way": "^1.13.0", | ||
"lru-cache": "^4.1.3", | ||
"benchmark": "^2.1.4", | ||
"standard": "^11.0.1", | ||
@@ -21,0 +21,0 @@ "tap": "^12.0.1" |
@@ -5,36 +5,9 @@ # badgen [![npm-version][npm-badge]][npm-link] [![install size][pp-badge]][pp-link] | ||
- 🌀 No dependeny. | ||
- ⚡️ 200K+ ops on average. (see [benchamrks](#Benchmarks)) | ||
## Usage | ||
### Badge Service | ||
### npm package | ||
`https://badgen.now.sh/badge/:subject/:status/:color` | ||
- `subject` Text | ||
- `status` Text | ||
- `color` Color RGB (default '3C1') or Color Preset (`green`, `yellow`, ...see below) | ||
Color Presets: | ||
![](https://badgen.now.sh/badge/color/green/green) | ||
![](https://badgen.now.sh/badge/color/yellow/yellow) | ||
![](https://badgen.now.sh/badge/color/orange/orange) | ||
![](https://badgen.now.sh/badge/color/red/red) | ||
![](https://badgen.now.sh/badge/color/pink/pink) | ||
![](https://badgen.now.sh/badge/color/purple/purple) | ||
![](https://badgen.now.sh/badge/color/blue/blue) | ||
![](https://badgen.now.sh/badge/color/grey/grey) | ||
![](https://badgen.now.sh/badge/color/black/black) | ||
Examples: | ||
| Preview | URL | | ||
| --- | --- | | ||
|![](https://badgen.now.sh/badge/build/passing) | https://badgen.now.sh/badge/build/passing | | ||
|![](https://badgen.now.sh/badge/style/standard/f2a) | https://badgen.now.sh/badge/style/standard/f2a | | ||
|![](https://badgen.now.sh/badge/license/Apache-2.0/blue) | https://badgen.now.sh/badge/license/Apache-2.0/blue | | ||
|![](https://badgen.now.sh/list/platform/ios,macos,tvos/grey) | https://badgen.now.sh/list/platform/ios,macos,tvos/grey | | ||
### Programmatically | ||
`npm install badgen` | ||
@@ -52,2 +25,16 @@ | ||
### Badge Service | ||
https://badgen.now.sh/ | ||
## Benchmarks | ||
`npm run bench` on my iMac5K(Late 2014), 3.5G i5, with Node.js 10.5.0: | ||
```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) | ||
``` | ||
## License | ||
@@ -54,0 +41,0 @@ |
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
3
6
87
7834
46