Skip to content

Commit

Permalink
Update README.md (#265)
Browse files Browse the repository at this point in the history
import example for node users
  • Loading branch information
kylebakerio authored Feb 28, 2021
1 parent 0c1e122 commit 41543ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,16 @@ Test configuration: Dell XPS 2-in-1 7390, Fedora 32, Node.js 15.1.
The main module uses URL-friendly symbols (`A-Za-z0-9_-`) and returns an ID
with 21 characters (to have a collision probability similar to UUID v4).

#### Modules
```js
import { nanoid } from 'nanoid'
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
```
#### Node
```js
const { nanoid } = require('nanoid');
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
```

If you want to reduce the ID size (and increase collisions probability),
you can pass the size as an argument.
Expand Down

0 comments on commit 41543ff

Please sign in to comment.