nanoid 3.1.17 → 3.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nanoid might be problematic. Click here for more details.

package/README.md CHANGED
@@ -47,7 +47,6 @@ Supports modern browsers, IE [with Babel], Node.js and React Native.
47
47
  * [Create React App](#create-react-app)
48
48
  * [React Native](#react-native)
49
49
  * [Rollup](#rollup)
50
- * [Expo](#expo)
51
50
  * [PouchDB and CouchDB](#pouchdb-and-couchdb)
52
51
  * [Mongoose](#mongoose)
53
52
  * [ES Modules](#es-modules)
@@ -74,9 +73,9 @@ There are three main differences between Nano ID and UUID v4:
74
73
 
75
74
  1. Nano ID uses a bigger alphabet, so a similar number of random bits
76
75
  are packed in just 21 symbols instead of 36.
77
- 2. Nano ID code is 3 times less than `uuid/v4` package:
78
- 108 bytes instead of 345.
79
- 3. Because of memory allocation tricks, Nano ID is 16% faster than UUID.
76
+ 2. Nano ID code is **4.5 times less** than `uuid/v4` package:
77
+ 108 bytes instead of 483.
78
+ 3. Because of memory allocation tricks, Nano ID is **60%** faster than UUID.
80
79
 
81
80
 
82
81
  ## Benchmark
@@ -85,8 +84,8 @@ There are three main differences between Nano ID and UUID v4:
85
84
  $ node ./test/benchmark.js
86
85
  nanoid 2,280,683 ops/sec
87
86
  customAlphabet 1,851,117 ops/sec
88
- uid.sync 313,306 ops/sec
89
87
  uuid v4 1,348,425 ops/sec
88
+ uid.sync 313,306 ops/sec
90
89
  secure-random-string 294,161 ops/sec
91
90
  cuid 158,988 ops/sec
92
91
  shortid 37,222 ops/sec
@@ -139,7 +138,7 @@ Test configuration: Dell XPS 2-in-1 7390, Fedora 32, Node.js 15.1.
139
138
  Tidelift will coordinate the fix and disclosure.
140
139
 
141
140
  [Secure random values (in Node.js)]: https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba
142
- [better algorithm]: https://github.com/ai/nanoid/blob/master/index.js
141
+ [better algorithm]: https://github.com/ai/nanoid/blob/main/index.js
143
142
 
144
143
 
145
144
  ## Usage
@@ -154,6 +153,12 @@ import { nanoid } from 'nanoid'
154
153
  model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
155
154
  ```
156
155
 
156
+ In Node.js you can use CommonJS import:
157
+
158
+ ```js
159
+ const { nanoid } = require('nanoid')
160
+ ```
161
+
157
162
  If you want to reduce the ID size (and increase collisions probability),
158
163
  you can pass the size as an argument.
159
164
 
@@ -192,22 +197,43 @@ import { nanoid } from 'nanoid'
192
197
 
193
198
  ### React
194
199
 
195
- **Do not** call `nanoid` in the `key` prop. In React, `key` should be consistent
196
- among renders.
200
+ There’s currently no correct way to use nanoid for React `key` prop
201
+ since it should be consistent among renders.
197
202
 
198
- This is the bad example:
203
+ ```jsx
204
+ function Todos({todos}) {
205
+ return (
206
+ <ul>
207
+ {todos.map(todo => (
208
+ <li key={nanoid()}> /* DON’T DO IT */
209
+ {todo.text}
210
+ </li>
211
+ ))}
212
+ </ul>
213
+ )
214
+ }
215
+ ```
216
+
217
+ You should rather try to reach for stable id inside your list item.
199
218
 
200
219
  ```jsx
201
- <Item key={nanoid()} /> /* DON’T DO IT */
220
+ const todoItems = todos.map((todo) =>
221
+ <li key={todo.id}>
222
+ {todo.text}
223
+ </li>
224
+ )
202
225
  ```
203
226
 
204
- This is the good example (`id` will be generated only once):
227
+ In case you don’t have stable ids you'd rather use index as `key`
228
+ instead of `nanoid()`:
205
229
 
206
230
  ```jsx
207
- const Element = () => {
208
- const [id] = React.useState(nanoid)
209
- return <Item key={id} />
210
- }
231
+ const todoItems = todos.map((text, index) =>
232
+ <li key={index}> /* Still not recommended but preferred over nanoid().
233
+ Only do this if items have no stable IDs. */
234
+ {text}
235
+ </li>
236
+ )
211
237
  ```
212
238
 
213
239
  If you want to use Nano ID in the `id` prop, you must set some string prefix
@@ -235,7 +261,8 @@ Use Nano ID 2 `npm i nanoid@^2.0.0` until Create React App 4.0 release.
235
261
 
236
262
  ### React Native
237
263
 
238
- React Native does not have built-in random generator.
264
+ React Native does not have built-in random generator. The following polyfill
265
+ works for plain React Native and Expo starting with `39.x`.
239
266
 
240
267
  1. Check [`react-native-get-random-values`] docs and install it.
241
268
  2. Import it before Nano ID.
@@ -252,39 +279,25 @@ For Expo framework see the next section.
252
279
 
253
280
  ### Rollup
254
281
 
255
- For Rollup you will need [`@rollup/plugin-replace`] to replace
282
+ For Rollup you will need [`@rollup/plugin-node-resolve`] to bundle browser version
283
+ of this library and [`@rollup/plugin-replace`] to replace
256
284
  `process.env.NODE_ENV`:
257
285
 
258
286
  ```js
259
287
  plugins: [
288
+ nodeResolve({
289
+ browser: true
290
+ }),
260
291
  replace({
261
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE)
292
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
262
293
  })
263
294
  ]
264
295
  ```
265
296
 
297
+ [`@rollup/plugin-node-resolve`]: https://github.com/rollup/plugins/tree/master/packages/node-resolve
266
298
  [`@rollup/plugin-replace`]: https://github.com/rollup/plugins/tree/master/packages/replace
267
299
 
268
300
 
269
- ### Expo
270
-
271
- If you use Expo in React Native, you need a different workaround.
272
-
273
- 1. Install [`expo-random`](https://www.npmjs.com/package/expo-random).
274
- 2. Use `nanoid/async` instead of `nanoid`.
275
- 3. Import `index.native.js` file directly.
276
-
277
- ```js
278
- import { nanoid } from 'nanoid/async/index.native'
279
-
280
- async function createUser () {
281
- user.id = await nanoid()
282
- }
283
- ```
284
-
285
- [`expo-random`]: https://www.npmjs.com/package/expo-random
286
-
287
-
288
301
  ### PouchDB and CouchDB
289
302
 
290
303
  In PouchDB and CouchDB, IDs can’t start with an underscore `_`.
@@ -383,6 +396,7 @@ the same ID generator on the client and server side.
383
396
  * [Janet](https://sr.ht/~statianzo/janet-nanoid/)
384
397
  * [Java](https://github.com/aventrix/jnanoid)
385
398
  * [Nim](https://github.com/icyphox/nanoid.nim)
399
+ * [Perl](https://github.com/tkzwtks/Nanoid-perl)
386
400
  * [PHP](https://github.com/hidehalo/nanoid-php)
387
401
  * [Python](https://github.com/puyuan/py-nanoid)
388
402
  with [dictionaries](https://pypi.org/project/nanoid-dictionary)
@@ -34,8 +34,7 @@ let customAlphabet = (alphabet, size) => {
34
34
  while (i--) {
35
35
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
36
36
  id += alphabet[bytes[i] & mask] || ''
37
- // `id.length + 1 === size` is a more compact option.
38
- if (id.length === +size) return Promise.resolve(id)
37
+ if (id.length === size) return Promise.resolve(id)
39
38
  }
40
39
  }
41
40
  }
package/async/index.cjs CHANGED
@@ -45,8 +45,7 @@ let customAlphabet = (alphabet, size) => {
45
45
  while (i--) {
46
46
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
47
47
  id += alphabet[bytes[i] & mask] || ''
48
- // `id.length + 1 === size` is a more compact option.
49
- if (id.length === +size) return id
48
+ if (id.length === size) return id
50
49
  }
51
50
  return tick(id)
52
51
  })
package/async/index.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * @param size Size of the ID. The default size is 21.
15
15
  * @returns A promise with a random string.
16
16
  */
17
- export function nanoid (size?: number): Promise<string>
17
+ export function nanoid(size?: number): Promise<string>
18
18
 
19
19
  /**
20
20
  * A low-level function.
@@ -35,7 +35,7 @@ export function nanoid (size?: number): Promise<string>
35
35
  * })
36
36
  * ```
37
37
  */
38
- export function customAlphabet (
38
+ export function customAlphabet(
39
39
  alphabet: string,
40
40
  size: number
41
41
  ): () => Promise<string>
@@ -53,4 +53,4 @@ export function customAlphabet (
53
53
  * @param bytes Size of the array.
54
54
  * @returns A promise with a random bytes array.
55
55
  */
56
- export function random (bytes: number): Promise<Uint8Array>
56
+ export function random(bytes: number): Promise<Uint8Array>
package/async/index.js CHANGED
@@ -45,8 +45,7 @@ let customAlphabet = (alphabet, size) => {
45
45
  while (i--) {
46
46
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
47
47
  id += alphabet[bytes[i] & mask] || ''
48
- // `id.length + 1 === size` is a more compact option.
49
- if (id.length === +size) return id
48
+ if (id.length === size) return id
50
49
  }
51
50
  return tick(id)
52
51
  })
@@ -31,8 +31,7 @@ let customAlphabet = (alphabet, size) => {
31
31
  while (i--) {
32
32
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
33
33
  id += alphabet[bytes[i] & mask] || ''
34
- // `id.length + 1 === size` is a more compact option.
35
- if (id.length === +size) return id
34
+ if (id.length === size) return id
36
35
  }
37
36
  return tick(id)
38
37
  })
package/index.browser.js CHANGED
@@ -14,8 +14,7 @@ if (process.env.NODE_ENV !== 'production') {
14
14
  'React Native does not have a built-in secure random generator. ' +
15
15
  'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
16
16
  'For secure IDs, import `react-native-get-random-values` ' +
17
- 'before Nano ID. If you use Expo, install `expo-random` ' +
18
- 'and use `nanoid/async`.'
17
+ 'before Nano ID.'
19
18
  )
20
19
  }
21
20
  if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
@@ -67,8 +66,7 @@ let customRandom = (alphabet, size, getRandom) => {
67
66
  while (j--) {
68
67
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
69
68
  id += alphabet[bytes[j] & mask] || ''
70
- // `id.length + 1 === size` is a more compact option.
71
- if (id.length === +size) return id
69
+ if (id.length === size) return id
72
70
  }
73
71
  }
74
72
  }
package/index.cjs CHANGED
@@ -49,13 +49,12 @@ let customRandom = (alphabet, size, getRandom) => {
49
49
  let id = ''
50
50
  while (true) {
51
51
  let bytes = getRandom(step)
52
- // A compact alternative for `for (var i = 0; i < step; i++)`.
52
+ // A compact alternative for `for (let i = 0; i < step; i++)`.
53
53
  let i = step
54
54
  while (i--) {
55
55
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
56
56
  id += alphabet[bytes[i] & mask] || ''
57
- // `id.length + 1 === size` is a more compact option.
58
- if (id.length === +size) return id
57
+ if (id.length === size) return id
59
58
  }
60
59
  }
61
60
  }
@@ -66,7 +65,7 @@ let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random)
66
65
  let nanoid = (size = 21) => {
67
66
  let bytes = random(size)
68
67
  let id = ''
69
- // A compact alternative for `for (var i = 0; i < step; i++)`.
68
+ // A compact alternative for `for (let i = 0; i < size; i++)`.
70
69
  while (size--) {
71
70
  // It is incorrect to use bytes exceeding the alphabet size.
72
71
  // The following mask reduces the random byte in the 0-255 value
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * @param size Size of the ID. The default size is 21.
13
13
  * @returns A random string.
14
14
  */
15
- export function nanoid (size?: number): string
15
+ export function nanoid(size?: number): string
16
16
 
17
17
  /**
18
18
  * Generate secure unique ID with custom alphabet.
@@ -30,7 +30,7 @@ export function nanoid (size?: number): string
30
30
  * nanoid() //=> "8ё56а"
31
31
  * ```
32
32
  */
33
- export function customAlphabet (alphabet: string, size: number): () => string
33
+ export function customAlphabet(alphabet: string, size: number): () => string
34
34
 
35
35
  /**
36
36
  * Generate unique ID with custom random generator and alphabet.
@@ -57,7 +57,7 @@ export function customAlphabet (alphabet: string, size: number): () => string
57
57
  * @param random A random bytes generator.
58
58
  * @returns A random string generator.
59
59
  */
60
- export function customRandom (
60
+ export function customRandom(
61
61
  alphabet: string,
62
62
  size: number,
63
63
  random: (bytes: number) => Uint8Array
@@ -68,7 +68,7 @@ export function customRandom (
68
68
  *
69
69
  * ```js
70
70
  * import { urlAlphabet } from 'nanoid'
71
- * const nanoid = customRandom(urlAlphabet, 10)
71
+ * const nanoid = customAlphabet(urlAlphabet, 10)
72
72
  * nanoid() //=> "Uakgb_J5m9"
73
73
  * ```
74
74
  */
@@ -85,4 +85,4 @@ export const urlAlphabet: string
85
85
  * @param bytes Size of the array.
86
86
  * @returns An array of random bytes.
87
87
  */
88
- export function random (bytes: number): Uint8Array
88
+ export function random(bytes: number): Uint8Array
package/index.dev.js CHANGED
@@ -14,8 +14,7 @@ if (true) {
14
14
  'React Native does not have a built-in secure random generator. ' +
15
15
  'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
16
16
  'For secure IDs, import `react-native-get-random-values` ' +
17
- 'before Nano ID. If you use Expo, install `expo-random` ' +
18
- 'and use `nanoid/async`.'
17
+ 'before Nano ID.'
19
18
  )
20
19
  }
21
20
  if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
@@ -67,8 +66,7 @@ let customRandom = (alphabet, size, getRandom) => {
67
66
  while (j--) {
68
67
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
69
68
  id += alphabet[bytes[j] & mask] || ''
70
- // `id.length + 1 === size` is a more compact option.
71
- if (id.length === +size) return id
69
+ if (id.length === size) return id
72
70
  }
73
71
  }
74
72
  }
package/index.js CHANGED
@@ -49,13 +49,12 @@ let customRandom = (alphabet, size, getRandom) => {
49
49
  let id = ''
50
50
  while (true) {
51
51
  let bytes = getRandom(step)
52
- // A compact alternative for `for (var i = 0; i < step; i++)`.
52
+ // A compact alternative for `for (let i = 0; i < step; i++)`.
53
53
  let i = step
54
54
  while (i--) {
55
55
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
56
56
  id += alphabet[bytes[i] & mask] || ''
57
- // `id.length + 1 === size` is a more compact option.
58
- if (id.length === +size) return id
57
+ if (id.length === size) return id
59
58
  }
60
59
  }
61
60
  }
@@ -66,7 +65,7 @@ let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random)
66
65
  let nanoid = (size = 21) => {
67
66
  let bytes = random(size)
68
67
  let id = ''
69
- // A compact alternative for `for (var i = 0; i < step; i++)`.
68
+ // A compact alternative for `for (let i = 0; i < size; i++)`.
70
69
  while (size--) {
71
70
  // It is incorrect to use bytes exceeding the alphabet size.
72
71
  // The following mask reduces the random byte in the 0-255 value
package/index.prod.js CHANGED
@@ -14,8 +14,7 @@ if (false) {
14
14
  'React Native does not have a built-in secure random generator. ' +
15
15
  'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
16
16
  'For secure IDs, import `react-native-get-random-values` ' +
17
- 'before Nano ID. If you use Expo, install `expo-random` ' +
18
- 'and use `nanoid/async`.'
17
+ 'before Nano ID.'
19
18
  )
20
19
  }
21
20
  if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
@@ -67,8 +66,7 @@ let customRandom = (alphabet, size, getRandom) => {
67
66
  while (j--) {
68
67
  // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
69
68
  id += alphabet[bytes[j] & mask] || ''
70
- // `id.length + 1 === size` is a more compact option.
71
- if (id.length === +size) return id
69
+ if (id.length === size) return id
72
70
  }
73
71
  }
74
72
  }
@@ -10,7 +10,7 @@
10
10
  * @param size Size of the ID. The default size is 21.
11
11
  * @returns A random string.
12
12
  */
13
- export function nanoid (size?: number): string
13
+ export function nanoid(size?: number): string
14
14
 
15
15
  /**
16
16
  * Generate URL-friendly unique ID based on the custom alphabet.
@@ -27,4 +27,4 @@ export function nanoid (size?: number): string
27
27
  * model.id = //=> "8ё56а"
28
28
  * ```
29
29
  */
30
- export function customAlphabet (alphabet: string, size: number): () => string
30
+ export function customAlphabet(alphabet: string, size: number): () => string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nanoid",
3
- "version": "3.1.17",
3
+ "version": "3.1.21",
4
4
  "description": "A tiny (108 bytes), secure URL-friendly unique string ID generator",
5
5
  "keywords": [
6
6
  "uuid",
@@ -37,31 +37,20 @@
37
37
  "./package.json": "./package.json",
38
38
  "./async/package.json": "./async/package.json",
39
39
  "./async": {
40
- "browser": {
41
- "development": "./async/index.dev.js",
42
- "production": "./async/index.prod.js"
43
- },
40
+ "browser": "./async/index.browser.js",
44
41
  "require": "./async/index.cjs",
45
42
  "import": "./async/index.js"
46
43
  },
47
- "./url-alphabet/package.json": "./url-alphabet/package.json",
48
- "./url-alphabet": {
49
- "browser": {
50
- "development": "./url-alphabet/index.dev.js",
51
- "production": "./url-alphabet/index.prod.js"
52
- },
53
- "require": "./url-alphabet/index.cjs",
54
- "import": "./url-alphabet/index.js"
55
- },
56
44
  "./non-secure/package.json": "./non-secure/package.json",
57
45
  "./non-secure": {
58
- "browser": {
59
- "development": "./non-secure/index.dev.js",
60
- "production": "./non-secure/index.prod.js"
61
- },
62
46
  "require": "./non-secure/index.cjs",
63
47
  "import": "./non-secure/index.js"
64
48
  },
49
+ "./url-alphabet/package.json": "./url-alphabet/package.json",
50
+ "./url-alphabet": {
51
+ "require": "./url-alphabet/index.cjs",
52
+ "import": "./url-alphabet/index.js"
53
+ },
65
54
  "./index.d.ts": "./index.d.ts"
66
55
  }
67
56
  }
package/CHANGELOG.md DELETED
@@ -1,232 +0,0 @@
1
- # Change Log
2
- This project adheres to [Semantic Versioning](http://semver.org/).
3
-
4
- ## 3.1.17
5
- * Fix `esbuild` support.
6
-
7
- ## 3.1.16
8
- * Speeded up Nano ID 4 times (by Peter Boyer).
9
-
10
- ## 3.1.15
11
- * Fixed `package.types` path.
12
-
13
- ## 3.1.14
14
- * Added `package.types`.
15
-
16
- ## 3.1.13
17
- * Removed Node.js 15.0.0 with `randomFillSync` regression from `engines.node`.
18
-
19
- ## 3.1.12
20
- * Improved IE 11 docs.
21
-
22
- ## 3.1.11
23
- * Fixed asynchronous `customAlphabet` in browser (by @LoneRifle).
24
-
25
- ## 3.1.10
26
- * Fix ES modules support.
27
-
28
- ## 3.1.9
29
- * Try to fix React Native Expo support.
30
-
31
- ## 3.1.8
32
- * Add React Native Expo support.
33
-
34
- ## 3.1.7
35
- * Clean up code.
36
-
37
- ## 3.1.6
38
- * Avoid `self` using.
39
-
40
- ## 3.1.5
41
- * Improve IE docs and warning.
42
-
43
- ## 3.1.4
44
- * Restrict old Node.js 13 by `engines.node` (by Cansin Yildiz).
45
-
46
- ## 3.1.3
47
- * Fix ES modules issue with CLI.
48
-
49
- ## 3.1.2
50
- * Add shebang to CLI.
51
-
52
- ## 3.1.1
53
- * Fix CLI.
54
-
55
- ## 3.1
56
- * Add `npx nanoid` CLI.
57
-
58
- ## 3.0.2
59
- * Fix docs (by Dylan Irlbeck ).
60
-
61
- ## 3.0.1
62
- * Fix React Native warning on `non-secure` import (by Jia Huang).
63
-
64
- ## 3.0
65
- **Migration guide:** <https://github.com/ai/nanoid/releases/tag/3.0.0>
66
- * Move to ES2016 syntax. You need to use Babel for IE 11.
67
- * Move to named exports `import { nanoid } from 'nanoid'`.
68
- * Move `import url from 'nanoid/url'` to `import { urlAlphabet } from 'nanoid'`.
69
- * Replace `format()` to `customRandom()`.
70
- * Replace `generate()` to `customAlphabet()`.
71
- * Remove `async/format`.
72
- * Remove React Native support for `nanoid/async`.
73
- * Add `nanoid.js` to use directly in browser from CDN.
74
- * Add TypeScript type definitions.
75
- * Add ES modules support for bundlers, Node.js, and React Native.
76
- * Fix React Native support.
77
- * Reduce size.
78
- * Improve docs (by Dair Aidarkhanov).
79
-
80
- ## 2.1.11
81
- * Reduce size (by Anton Evzhakov).
82
-
83
- ## 2.1.10
84
- * Reduce size by 10% (by Anton Khlynovskiy).
85
-
86
- ## 2.1.9
87
- * Reduce `format` and `async/format` size (by Dair Aidarkhanov).
88
-
89
- ## 2.1.8
90
- * Improve React docs (by Nahum Zsilva).
91
-
92
- ## 2.1.7
93
- * Reduce `index`, `async` and `non-secure` size (by @polemius).
94
-
95
- ## 2.1.6
96
- * Reduce size (by Stas Lashmanov).
97
- * Return fast mask for Node.js.
98
-
99
- ## 2.1.5
100
- * Reduce size (by Max Graey).
101
- * Fix IE support.
102
-
103
- ## 2.1.4
104
- * Reduce `generate` size (by Vsevolod Rodionov).
105
- * Reduce `format` and `format` size (by Victor).
106
- * Reduce `async`, `non-secure` and `non-secure/generate` size.
107
- * Speed up `format` and `async/format` (by Max Graey).
108
- * Improve development process on Windows (by Stanislav Lashmanov).
109
-
110
- ## 2.1.3
111
- * Improve performance (by Stephen Richardson).
112
- * Reduce size (by Stephen Richardson).
113
-
114
- ## 2.1.2
115
- * Improve docs.
116
-
117
- ## 2.1.1
118
- * Fix React Native support (by Shawn Hwei).
119
-
120
- ## 2.1
121
- * Improve React Native support (by Sebastian Werner).
122
-
123
- ## 2.0.4
124
- * Improve error text for React Native (by Sebastian Werner).
125
-
126
- ## 2.0.3
127
- * Fix freeze on string in ID length.
128
-
129
- ## 2.0.2
130
- * Improve docs (by Sylvanus Kateile and Mark Stosberg).
131
-
132
- ## 2.0.1
133
- * Reduce npm package size.
134
- * Mark package as not having side effects (by @xiaody).
135
-
136
- ## 2.0
137
- * Use `-` instead of `~` in default alphabet to by file name safe.
138
- * Add `nanoid/non-secure/generate`.
139
-
140
- ## 1.3.4
141
- * Reduce `non-secure` size.
142
- * Add `async` callback type check.
143
-
144
- ## 1.3.3
145
- * Fix `nanoid/async` performance regression.
146
- * Fix old Node.js `not seeded` issue in synchronous version too.
147
-
148
- ## 1.3.2
149
- * Fix random generator `not seeded` issue of old Node.js.
150
-
151
- ## 1.3.1
152
- * Reduce library size.
153
-
154
- ## 1.3
155
- * Add `nanoid/async/format` and `nanoid/async/generate`.
156
- * Improve synchronous API performance.
157
- * Reduce `url` size (by Daniil Poroshin).
158
- * Improve React Native docs (by joelgetaction).
159
-
160
- ## 1.2.6
161
- * Reduce library size (by rqrqrqrq).
162
-
163
- ## 1.2.5
164
- * Fix Node.js 6.11.1 support (by Andrey Belym).
165
-
166
- ## 1.2.4
167
- * Speed up Node.js secure generators (by Dmitriy Tsvettsikh).
168
-
169
- ## 1.2.3
170
- * Fix JSDoc (by Hendry Sadrak).
171
-
172
- ## 1.2.2
173
- * Fix distribution in `nanoid/non-secure` (by Eatall).
174
-
175
- ## 1.2.1
176
- * Fix old Node.js support.
177
-
178
- ## 1.2
179
- * Add `nanoid/async`.
180
- * Fix `nanoid/non-secure` JSDoc.
181
- * Add Chinese documentation (by Wenliang Dai).
182
- * Speed up and reduce size of `nanoid/non-secure` (by Ori Livni).
183
-
184
- ## 1.1.1
185
- * Improve performance and reduce size of non-secure ID generator.
186
-
187
- ## 1.1
188
- * Add non-secure ID generator.
189
- * Suggest to use non-secure ID generator for React Native developers.
190
- * Reduce size.
191
-
192
- ## 1.0.7
193
- * Fix documentation.
194
-
195
- ## 1.0.6
196
- * Fix documentation.
197
-
198
- ## 1.0.5
199
- * Reduce `nanoid/index` size (by Anton Khlynovskiy).
200
-
201
- ## 1.0.4
202
- * Reduce npm package size.
203
-
204
- ## 1.0.3
205
- * Reduce npm package size.
206
-
207
- ## 1.0.2
208
- * Fix Web Workers support (by Zachary Golba).
209
-
210
- ## 1.0.1
211
- * Reduce `nanoid/index` size (by Anton Khlynovskiy).
212
-
213
- ## 1.0
214
- * Use 21 symbols by default (by David Klebanoff).
215
-
216
- ## 0.2.2
217
- * Reduce `nanoid/generate` size (by Anton Khlynovskiy).
218
- * Speed up Node.js random generator.
219
-
220
- ## 0.2.1
221
- * Fix documentation (by Piper Chester).
222
-
223
- ## 0.2
224
- * Add `size` argument to `nanoid()`.
225
- * Improve performance by 50%.
226
- * Reduce library size by 26% (by Vsevolod Rodionov and Oleg Mokhov).
227
-
228
- ## 0.1.1
229
- * Reduce library size by 5%.
230
-
231
- ## 0.1
232
- * Initial release.