Skip to content
Myr

Sync English and Russian docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Sitnik · committed by Andrey Sitnik · parent f74a41d · Browse files · 2 files+23 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+23 added−16 removed

  • other:+23 added−16 removed

2 files+23 added−16 removed

modified:README.md+14 added-16 removed
250 unmodified lines
251const nanoid = customAlphabet('1234567890abcdef', 10)252model.id = nanoid() //=> "4f90d13a42"253```254255```js256import { customAlphabet } from 'nanoid/async'257const nanoid = customAlphabet('1234567890abcdef', 10)258async function createUser () {259 user.id = await nanoid()260}261```262263```js264import { customAlphabet } from 'nanoid/non-secure'265const nanoid = customAlphabet('1234567890abcdef', 10)266user.id = nanoid()267```268269Check the safety of your custom alphabet and ID size in our270[ID collision probability] calculator. For more alphabets, check out the options271in [`nanoid-dictionary`].272
8 unmodified lines
281const nanoid = customAlphabet('1234567890abcdef', 10)282model.id = nanoid(5) //=> "f01a2"283```284271Customizable asynchronous and non-secure APIs are also available:272273```js274import { customAlphabet } from 'nanoid/async'275const nanoid = customAlphabet('1234567890abcdef', 10)276async function createUser () {277 user.id = await nanoid()278}279```280281```js282import { customAlphabet } from 'nanoid/non-secure'283const nanoid = customAlphabet('1234567890abcdef', 10)284user.id = nanoid()285```286285[ID collision probability]: https://alex7kom.github.io/nano-nanoid-cc/286[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary287288
253 unmodified lines
modified:README.ru.md+9 added
282 unmodified lines
283284Алфавит должен содержать ≤256 символов. Иначе мы не сможем гарантировать285непредсказуемость ID.286287Длину ID можно менять не только в `customAlphabet()`, но и при вызове288генератора, который она вернёт:289290```js291import { customAlphabet } from 'nanoid'292const nanoid = customAlphabet('1234567890abcdef', 10)293model.id = nanoid(5) //=> "f01a2"294```295296[на нашем калькуляторе]: https://alex7kom.github.io/nano-nanoid-cc/297[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary298299
227 unmodified lines