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" Copy
import { nanoid } from 'nanoid'model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
Optional
Size of the ID. The default size is 21.
A random string.
Generate secure URL-friendly unique ID.
By default, the ID will have 21 symbols to have a collision probability similar to UUID v4.