@@ -252,6 +252,20 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
252252model .id = nanoid () // => "4f90d13a42"
253253```
254254
255+ ``` js
256+ import { customAlphabet } from ' nanoid/async'
257+ const nanoid = customAlphabet (' 1234567890abcdef' , 10 )
258+ async function createUser () {
259+ user .id = await nanoid ()
260+ }
261+ ```
262+
263+ ``` js
264+ import { customAlphabet } from ' nanoid/non-secure'
265+ const nanoid = customAlphabet (' 1234567890abcdef' , 10 )
266+ user .id = nanoid ()
267+ ```
268+
255269Check the safety of your custom alphabet and ID size in our
256270[ ID collision probability] calculator. For more alphabets, check out the options
257271in [ ` nanoid-dictionary ` ] .
@@ -268,22 +282,6 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
268282model .id = nanoid (5 ) // => "f01a2"
269283```
270284
271- Customizable asynchronous and non-secure APIs are also available:
272-
273- ``` js
274- import { customAlphabet } from ' nanoid/async'
275- const nanoid = customAlphabet (' 1234567890abcdef' , 10 )
276- async function createUser () {
277- user .id = await nanoid ()
278- }
279- ```
280-
281- ``` js
282- import { customAlphabet } from ' nanoid/non-secure'
283- const nanoid = customAlphabet (' 1234567890abcdef' , 10 )
284- user .id = nanoid ()
285- ```
286-
287285[ ID collision probability ] : https://alex7kom.github.io/nano-nanoid-cc/
288286[ `nanoid-dictionary` ] : https://github.com/CyberAP/nanoid-dictionary
289287
0 commit comments