nanoid
nanoid<
Type
>(size?
):Type
Defined in: node_modules/.pnpm/nanoid@5.1.3/node_modules/nanoid/index.d.ts:28
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"
Type Parameters
Section titled “Type Parameters”Type
extends string
Parameters
Section titled “Parameters”number
Size of the ID. The default size is 21.
Returns
Section titled “Returns”Type
A random string.
Typeparam
Section titled “Typeparam”Type The ID type to replace string
with some opaque type.