Skip to content

Commit

Permalink
Simplify import docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Feb 28, 2021
1 parent 41543ff commit 62749b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ 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

In Node.js you can use CommonJS import:

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

If you want to reduce the ID size (and increase collisions probability),
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@
"transpile",
"workaround",
"Deno",
"polyfill"
"polyfill",
"CommonJS"
]
},
"sharec": {
Expand Down

0 comments on commit 62749b7

Please sign in to comment.