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 2.1.5 to 2.1.6

async/format.browser.js

7

async/format.js

@@ -39,7 +39,4 @@ /**

while (i--) {
var alpha = alphabet[bytes[i] & mask]
if (alpha) {
id += alpha
if (id.length === +size) return id
}
id += alphabet[bytes[i] & mask] || ''
if (id.length === +size) return id
}

@@ -46,0 +43,0 @@ return tick(id)

# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.1.6
* Reduce size (by Stas Lashmanov).
* Return fast mask for Node.js.
## 2.1.5

@@ -5,0 +9,0 @@ * Reduce size (by Max Graey).

@@ -30,3 +30,3 @@ /**

module.exports = function (random, alphabet, size) {
var mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1
var mask = (2 << 31 - Math.clz32((alphabet.length - 1) | 1)) - 1
var step = Math.ceil(1.6 * mask * size / alphabet.length)

@@ -39,7 +39,4 @@ var id = ''

while (i--) {
var alpha = alphabet[bytes[i] & mask]
if (alpha) {
id += alpha
if (id.length === +size) return id
}
id += alphabet[bytes[i] & mask] || ''
if (id.length === +size) return id
}

@@ -46,0 +43,0 @@ }

{
"name": "nanoid",
"version": "2.1.5",
"version": "2.1.6",
"description": "A tiny (139 bytes), secure URL-friendly unique string ID generator",

@@ -16,4 +16,6 @@ "keywords": [

"./index.js": "./index.browser.js",
"./format.js": "./format.browser.js",
"./random.js": "./random.browser.js",
"./async/index.js": "./async/index.browser.js",
"./async/format.js": "./async/format.browser.js",
"./async/random.js": "./async/random.browser.js"

@@ -20,0 +22,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