You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
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

Comparing version 3.1.18 to 3.1.19

bin/nanoid.test.js

6

async/index.browser.js

@@ -37,4 +37,4 @@ let random = bytes =>

id += alphabet[bytes[i] & mask] || ''
// `id.length + 1 === size` is a more compact option.
if (id.length === +size) return Promise.resolve(id)
// Return if id length equals size.
if (id.length === size) return Promise.resolve(id)
}

@@ -72,2 +72,2 @@ }

export { nanoid, customAlphabet, random }
module.exports = { nanoid, customAlphabet, random }

@@ -1,4 +0,4 @@

import crypto from 'crypto'
let crypto = require('crypto')
import { urlAlphabet } from '../url-alphabet/index.js'
let { urlAlphabet } = require('../url-alphabet')

@@ -48,4 +48,4 @@ // `crypto.randomFill()` is a little faster than `crypto.randomBytes()`,

id += alphabet[bytes[i] & mask] || ''
// `id.length + 1 === size` is a more compact option.
if (id.length === +size) return id
// Return if id length equals size.
if (id.length === size) return id
}

@@ -73,2 +73,2 @@ return tick(id)

export { nanoid, customAlphabet, random }
module.exports = { nanoid, customAlphabet, random }

@@ -1,4 +0,4 @@

import { getRandomBytesAsync } from 'expo-random'
let { getRandomBytesAsync } = require('expo-random')
import { urlAlphabet } from '../url-alphabet/index.js'
let { urlAlphabet } = require('../url-alphabet')

@@ -34,4 +34,4 @@ let random = getRandomBytesAsync

id += alphabet[bytes[i] & mask] || ''
// `id.length + 1 === size` is a more compact option.
if (id.length === +size) return id
// Return if id length equals size.
if (id.length === size) return id
}

@@ -59,2 +59,2 @@ return tick(id)

export { nanoid, customAlphabet, random }
module.exports = { nanoid, customAlphabet, random }
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 3.1.19
* Reduce `customAlphabet` size (by Enrico Scherlies).
## 3.1.18

@@ -5,0 +8,0 @@ * Fixed `package.exports`.

// This file replaces `index.js` in bundlers like webpack or Rollup,
// according to `browser` config in `package.json`.
import { urlAlphabet } from './url-alphabet/index.js'
let { urlAlphabet } = require('./url-alphabet')

@@ -70,4 +70,4 @@ if (process.env.NODE_ENV !== 'production') {

id += alphabet[bytes[j] & mask] || ''
// `id.length + 1 === size` is a more compact option.
if (id.length === +size) return id
// Return if id length equals size.
if (id.length === size) return id
}

@@ -107,2 +107,2 @@ }

export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }

@@ -1,4 +0,4 @@

import crypto from 'crypto'
let crypto = require('crypto')
import { urlAlphabet } from './url-alphabet/index.js'
let { urlAlphabet } = require('./url-alphabet')

@@ -57,4 +57,4 @@ // It is best to make fewer, larger requests to the crypto module to

id += alphabet[bytes[i] & mask] || ''
// `id.length + 1 === size` is a more compact option.
if (id.length === +size) return id
// Return if id length equals size.
if (id.length === size) return id
}

@@ -82,2 +82,2 @@ }

export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }

@@ -30,2 +30,2 @@ // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped

export { nanoid, customAlphabet }
module.exports = { nanoid, customAlphabet }
{
"name": "nanoid",
"version": "3.1.18",
"version": "3.1.19",
"description": "A tiny (108 bytes), secure URL-friendly unique string ID generator",

@@ -18,40 +18,11 @@ "keywords": [

"browser": {
"./index.js": "./index.browser.js"
"./index.js": "./index.browser.js",
"./async/index.js": "./async/index.browser.js"
},
"react-native": "index.js",
"react-native": {
"./async/index.js": "./async/index.native.js"
},
"bin": "./bin/nanoid.cjs",
"sideEffects": false,
"types": "./index.d.ts",
"type": "module",
"main": "index.cjs",
"module": "index.js",
"exports": {
".": {
"browser": {
"development": "./index.dev.js",
"production": "./index.prod.js"
},
"require": "./index.cjs",
"import": "./index.js",
"types": "./index.d.ts"
},
"./package.json": "./package.json",
"./async/package.json": "./async/package.json",
"./async": {
"browser": "./async/index.browser.js",
"require": "./async/index.cjs",
"import": "./async/index.js"
},
"./non-secure/package.json": "./non-secure/package.json",
"./non-secure": {
"require": "./non-secure/index.cjs",
"import": "./non-secure/index.js"
},
"./url-alphabet/package.json": "./url-alphabet/package.json",
"./url-alphabet": {
"require": "./url-alphabet/index.cjs",
"import": "./url-alphabet/index.js"
},
"./index.d.ts": "./index.d.ts"
}
}
"types": "./index.d.ts"
}

@@ -77,5 +77,5 @@ # Nano ID

are packed in just 21 symbols instead of 36.
2. Nano ID code is 3 times less than `uuid/v4` package:
108 bytes instead of 345.
3. Because of memory allocation tricks, Nano ID is 16% faster than UUID.
2. Nano ID code is **4.5 times less** than `uuid/v4` package:
108 bytes instead of 483.
3. Because of memory allocation tricks, Nano ID is **60%** faster than UUID.

@@ -89,4 +89,4 @@

customAlphabet 1,851,117 ops/sec
uuid v4 1,348,425 ops/sec
uid.sync 313,306 ops/sec
uuid v4 1,348,425 ops/sec
secure-random-string 294,161 ops/sec

@@ -93,0 +93,0 @@ cuid 158,988 ops/sec

@@ -6,2 +6,2 @@ // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped

export { urlAlphabet }
module.exports = { urlAlphabet }
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc