Comparing version 0.2.1 to 0.2.2
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 0.2.2 | ||
* Reduce `nanoid/generate` size (by Anton Khlynovskiy). | ||
* Speed up Node.js random generator. | ||
## 0.2.1 | ||
@@ -5,0 +9,0 @@ * Fix documentation (by Piper Chester). |
@@ -1,3 +0,1 @@ | ||
var masks = [15, 31, 63, 127, 255] | ||
/** | ||
@@ -29,5 +27,3 @@ * Secure random string generator with custom alphabet. | ||
module.exports = function (random, alphabet, size) { | ||
var mask = masks.find(function (i) { | ||
return i >= alphabet.length - 1 | ||
}) | ||
var mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1 | ||
var step = Math.ceil(1.6 * mask * size / alphabet.length) | ||
@@ -34,0 +30,0 @@ |
{ | ||
"name": "nanoid", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A tiny (179 bytes), secure URL-friendly unique string ID generator", | ||
@@ -21,3 +21,3 @@ "keywords": [ | ||
"docdash": "^0.4.0", | ||
"eslint": "^4.7.0", | ||
"eslint": "^4.8.0", | ||
"eslint-config-logux": "^16.2.0", | ||
@@ -27,4 +27,4 @@ "eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jest": "^21.1.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-jest": "^21.2.0", | ||
"eslint-plugin-node": "^5.2.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
@@ -34,5 +34,5 @@ "eslint-plugin-security": "^1.4.0", | ||
"html-webpack-plugin": "^2.30.1", | ||
"jest": "^21.1.0", | ||
"jest": "^21.2.1", | ||
"jsdoc": "^3.5.5", | ||
"lint-staged": "^4.2.1", | ||
"lint-staged": "^4.2.3", | ||
"microtime": "^2.1.6", | ||
@@ -42,5 +42,5 @@ "pre-commit": "^1.2.2", | ||
"shortid": "^2.2.8", | ||
"size-limit": "^0.11.3", | ||
"size-limit": "^0.11.6", | ||
"uuid": "^3.1.0", | ||
"webpack-dev-server": "^2.8.2", | ||
"webpack-dev-server": "^2.9.1", | ||
"yaspeller-ci": "^0.7.0" | ||
@@ -74,3 +74,3 @@ }, | ||
"path": "generate.js", | ||
"limit": "196 B" | ||
"limit": "184 B" | ||
} | ||
@@ -77,0 +77,0 @@ ], |
@@ -1,5 +0,1 @@ | ||
var randomBytes = require('crypto').randomBytes | ||
module.exports = function (bytes) { | ||
return randomBytes(bytes) | ||
} | ||
module.exports = require('crypto').randomBytes |
@@ -68,2 +68,13 @@ # Nano ID | ||
## Benchmark | ||
``` | ||
$ ./benchmark | ||
nanoid 375,840 ops/sec | ||
nanoid/generate 268,747 ops/sec | ||
uuid/v4 374,767 ops/sec | ||
shortid 41,260 ops/sec | ||
``` | ||
## Usage | ||
@@ -70,0 +81,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
10559
147
113