@@ -252,6 +252,20 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
252
252
model .id = nanoid () // => "4f90d13a42"
253
253
```
254
254
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
+
255
269
Check the safety of your custom alphabet and ID size in our
256
270
[ ID collision probability] calculator. For more alphabets, check out the options
257
271
in [ ` nanoid-dictionary ` ] .
@@ -268,22 +282,6 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
268
282
model .id = nanoid (5 ) // => "f01a2"
269
283
```
270
284
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
-
287
285
[ ID collision probability ] : https://alex7kom.github.io/nano-nanoid-cc/
288
286
[ `nanoid-dictionary` ] : https://github.com/CyberAP/nanoid-dictionary
289
287
0 commit comments