Socket
Socket
Sign inDemoInstall

nanoid

Package Overview
Dependencies
0
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.31 to 3.1.32

11

async/index.browser.js

@@ -1,7 +0,6 @@

let random = bytes =>
Promise.resolve(crypto.getRandomValues(new Uint8Array(bytes)))
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
let customAlphabet = (alphabet, size) => {
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
let step = -~((1.6 * mask * size) / alphabet.length)
return () => {
return async () => {
let id = ''

@@ -13,3 +12,3 @@ while (true) {

id += alphabet[bytes[i] & mask] || ''
if (id.length === size) return Promise.resolve(id)
if (id.length === size) return id
}

@@ -19,3 +18,3 @@ }

}
let nanoid = (size = 21) => {
let nanoid = async (size = 21) => {
let id = ''

@@ -35,4 +34,4 @@ let bytes = crypto.getRandomValues(new Uint8Array(size))

}
return Promise.resolve(id)
return id
}
export { nanoid, customAlphabet, random }
{
"name": "nanoid",
"version": "3.1.31",
"version": "3.1.32",
"description": "A tiny (130 bytes), secure URL-friendly unique string ID generator",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc