You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

nanoid

Package Overview
Dependencies
Maintainers
1
Versions
114
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
5.1.6
to
5.1.7
+10
-0
bin/nanoid.js
#!/usr/bin/env node
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { customAlphabet, nanoid } from '../index.js'

@@ -10,2 +13,8 @@ function print(msg) {

}
if (process.argv.includes('--version') || process.argv.includes('-v')) {
let root = dirname(fileURLToPath(import.meta.url))
let pkg = JSON.parse(readFileSync(join(root, '..', 'package.json'), 'utf8'))
print(pkg.version)
process.exit()
}
if (process.argv.includes('--help') || process.argv.includes('-h')) {

@@ -17,2 +26,3 @@ print(`Usage

-a, --alphabet Alphabet to use
-v, --version Show version number
-h, --help Show this help

@@ -19,0 +29,0 @@ Examples

+3
-3

@@ -42,3 +42,3 @@ /**

* ```js
* const { customAlphabet } = require('nanoid')
* import { customAlphabet } from 'nanoid'
* const nanoid = customAlphabet('0123456789абвгдеё', 5)

@@ -60,3 +60,3 @@ * nanoid() //=> "8ё56а"

* ```js
* import { customRandom } from 'nanoid/format'
* import { customRandom } from 'nanoid'
*

@@ -84,3 +84,3 @@ * const nanoid = customRandom('abcdef', 5, size => {

random: (bytes: number) => Uint8Array
): () => Type
): (size?: number) => Type

@@ -87,0 +87,0 @@ /**

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

let a="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";export let nanoid=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(let n=0;n<e;n++)t+=a[63&r[n]];return t};
let a="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";export let nanoid=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=a[63&r[e]];return t};
{
"name": "nanoid",
"version": "5.1.6",
"version": "5.1.7",
"description": "A tiny (118 bytes), secure URL-friendly unique string ID generator",

@@ -31,3 +31,6 @@ "keywords": [

},
"./non-secure": "./non-secure/index.js",
"./non-secure": {
"types": "./non-secure/index.d.ts",
"default": "./non-secure/index.js"
},
"./package.json": "./package.json"

@@ -34,0 +37,0 @@ },

@@ -6,3 +6,3 @@ # Nano ID

**English** | [日本語](./README.ja.md) | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) | [한국어](./README.ko.md)
**English** | [日本語](./README.ja.md) | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) | [한국어](./README.ko.md) | [العربية](./README.ar.md)

@@ -9,0 +9,0 @@ A tiny, secure, URL-friendly, unique string ID generator for JavaScript.

@@ -1,2 +0,2 @@

export const urlAlphabet =
export let urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'