Socket
Socket
Sign inDemoInstall

nanoid

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoid - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

3

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 1.1.1
* Improve performance and reduce size of non-secure ID generator.
## 1.1

@@ -5,0 +8,0 @@ * Add non-secure ID generator.

11

non-secure.js
var url = '_~getRandomVcryp0123456789bfhijklqsuvwxzABCDEFGHIJKLMNOPQSTUWXYZ'
function random (size) {
var result = []
while (0 < size--) {
result.push(Math.floor(Math.random() * 256))
}
return result
}
module.exports = function (size) {
size = size || 21
var id = ''
var bytes = random(size)
while (0 < size--) {
id += url[bytes[size] & 63]
id += url[Math.floor(Math.random() * 63)]
}
return id
}
{
"name": "nanoid",
"version": "1.1.0",
"description": "A tiny (143 bytes), secure URL-friendly unique string ID generator",
"version": "1.1.1",
"description": "A tiny (145 bytes), secure URL-friendly unique string ID generator",
"keywords": [

@@ -17,4 +17,3 @@ "uuid",

"./index.js": "./index.browser.js"
},
"scripts": {}
}
}

@@ -83,7 +83,9 @@ # Nano ID

$ ./test/benchmark
nanoid 353,737 ops/sec
nanoid/non-secure 2,043,665 ops/sec
nanoid/generate 348,442 ops/sec
uuid/v4 350,075 ops/sec
shortid 85,107 ops/sec
nanoid 363,539 ops/sec
nanoid/generate 352,418 ops/sec
uid.sync 332,502 ops/sec
uuid/v4 345,867 ops/sec
shortid 34,193 ops/sec
rndm 2,557,778 ops/sec
nanoid/non-secure 2,578,934 ops/sec
```

@@ -148,3 +150,3 @@

in our [ID collision probability] calculator.
You can find popular alphabets in [`nanoid-dictionary`].
You can find popular alphabets in [`nanoid-dictionary`].

@@ -192,2 +194,3 @@ Alphabet must contain 256 symbols or less.

* [`nanoid-cli`] to generate ID from CLI.
* [`nanoid-good`] to be sure that your ID doesn't contain any obscene words.

@@ -197,2 +200,3 @@ [`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary

[`nanoid-cli`]: https://github.com/twhitbeck/nanoid-cli
[`nanoid-good`]: https://github.com/y-gagar1n/nanoid-good

@@ -199,0 +203,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc