Skip to content

Commit c7f4219

Browse files
committed
Sync English and Russian docs
1 parent f74a41d commit c7f4219

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

README.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,20 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
252252
model.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+
255269
Check the safety of your custom alphabet and ID size in our
256270
[ID collision probability] calculator. For more alphabets, check out the options
257271
in [`nanoid-dictionary`].
@@ -268,22 +282,6 @@ const nanoid = customAlphabet('1234567890abcdef', 10)
268282
model.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

README.ru.md

+9
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,15 @@ user.id = nanoid()
284284
Алфавит должен содержать ≤256 символов. Иначе мы не сможем гарантировать
285285
непредсказуемость ID.
286286

287+
Длину ID можно менять не только в `customAlphabet()`, но и при вызове
288+
генератора, который она вернёт:
289+
290+
```js
291+
import { customAlphabet } from 'nanoid'
292+
const nanoid = customAlphabet('1234567890abcdef', 10)
293+
model.id = nanoid(5) //=> "f01a2"
294+
```
295+
287296
[на нашем калькуляторе]: https://alex7kom.github.io/nano-nanoid-cc/
288297
[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary
289298

0 commit comments

Comments
 (0)