Skip to content

nanoid

nanoid(size?): string

Defined in: .pnpm-home/store/v11/links/@/nanoid/5.0.9/52f37d9eb6b1dba0e3204630e7232cfe32a7cb5cd208f825c224678b81211815/node_modules/nanoid/index.d.ts:15

Generate secure URL-friendly unique ID.

By default, the ID will have 21 symbols to have a collision probability similar to UUID v4.

import { nanoid } from 'nanoid'
model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"

number

Size of the ID. The default size is 21.

string

A random string.