Comparing version 1.0.2 to 1.1.0
const gen = require('../src'); | ||
const { Suite } = require('benchmark'); | ||
suite('Benchmark', () => { | ||
set('concurrency', 10); | ||
const suite = new Suite(); | ||
bench('gen', () => { | ||
gen(); | ||
}); | ||
}); | ||
suite.add('gen', () => { | ||
gen(); | ||
}).on('cycle', (event) => { | ||
console.log(String(event.target)); | ||
}) | ||
.run({ async: true }); |
{ | ||
"name": "appkey", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "App Key/Secret Generator", | ||
@@ -14,2 +14,3 @@ "main": "src/index.js", | ||
"devDependencies": { | ||
"benchmark": "^2.1.4", | ||
"eslint": "^3.19.0", | ||
@@ -19,4 +20,3 @@ "eslint-config-airbnb": "^15.0.1", | ||
"eslint-plugin-jsx-a11y": "^5.0.1", | ||
"eslint-plugin-react": "^7.0.1", | ||
"matcha": "^0.7.0" | ||
"eslint-plugin-react": "^7.0.1" | ||
}, | ||
@@ -23,0 +23,0 @@ "repository": "git@github.com:AirDwing/node-appkey.git", |
@@ -35,8 +35,3 @@ # AppKey | ||
``` | ||
Benchmark | ||
gen ............................................ 138,249 op/s | ||
Suites: 1 | ||
Benches: 1 | ||
Elapsed: 762.67 ms | ||
gen x 121,577 ops/sec ±1.12% (78 runs sampled) | ||
``` | ||
@@ -43,0 +38,0 @@ |
@@ -7,6 +7,9 @@ const crypto = require('crypto'); | ||
const rnd = seed => (((seed * 9301) + 49297) % 233280) / (233280.0); | ||
const rand = number => Math.floor(rnd(new Date().getTime() * Math.random()) * number); | ||
const randStr = (len = 36) => { | ||
let pwd = ''; | ||
for (let i = 0; i < len; i += 1) { | ||
pwd += x.charAt(Math.floor(Math.random() * maxPos)); | ||
pwd += x.charAt(rand(maxPos)); | ||
} | ||
@@ -13,0 +16,0 @@ return pwd; |
Sorry, the diff of this file is not supported yet
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
43984
59
6
45