summaryrefslogtreecommitdiff
path: root/node_modules/nanoid
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-12-21 22:46:53 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-12-21 22:46:53 +0800
commitf06956efd2dc4bf77244a9fcce2b883a00b925af (patch)
tree0123cb73ce67f1f4b17e1d6cbabff076ee44e31b /node_modules/nanoid
parent8d980c13970c15b6d2312b6fc4ac51698dd0d220 (diff)
updated node modules
Diffstat (limited to 'node_modules/nanoid')
-rw-r--r--node_modules/nanoid/README.md2
-rw-r--r--node_modules/nanoid/index.d.cts91
-rw-r--r--node_modules/nanoid/package.json44
3 files changed, 125 insertions, 12 deletions
diff --git a/node_modules/nanoid/README.md b/node_modules/nanoid/README.md
index a4abd920..35abb57d 100644
--- a/node_modules/nanoid/README.md
+++ b/node_modules/nanoid/README.md
@@ -36,4 +36,4 @@ Supports modern browsers, IE [with Babel], Node.js and React Native.
</a>
## Docs
-Read **[full docs](https://github.com/ai/nanoid#readme)** on GitHub.
+Read full docs **[here](https://github.com/ai/nanoid#readme)**.
diff --git a/node_modules/nanoid/index.d.cts b/node_modules/nanoid/index.d.cts
new file mode 100644
index 00000000..3e111a39
--- /dev/null
+++ b/node_modules/nanoid/index.d.cts
@@ -0,0 +1,91 @@
+/**
+ * Generate secure URL-friendly unique ID.
+ *
+ * By default, the ID will have 21 symbols to have a collision probability
+ * similar to UUID v4.
+ *
+ * ```js
+ * import { nanoid } from 'nanoid'
+ * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
+ * ```
+ *
+ * @param size Size of the ID. The default size is 21.
+ * @returns A random string.
+ */
+export function nanoid(size?: number): string
+
+/**
+ * Generate secure unique ID with custom alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * @param alphabet Alphabet used to generate the ID.
+ * @param defaultSize Size of the ID. The default size is 21.
+ * @returns A random string generator.
+ *
+ * ```js
+ * const { customAlphabet } = require('nanoid')
+ * const nanoid = customAlphabet('0123456789абвгдеё', 5)
+ * nanoid() //=> "8ё56а"
+ * ```
+ */
+export function customAlphabet(
+ alphabet: string,
+ defaultSize?: number
+): (size?: number) => string
+
+/**
+ * Generate unique ID with custom random generator and alphabet.
+ *
+ * Alphabet must contain 256 symbols or less. Otherwise, the generator
+ * will not be secure.
+ *
+ * ```js
+ * import { customRandom } from 'nanoid/format'
+ *
+ * const nanoid = customRandom('abcdef', 5, size => {
+ * const random = []
+ * for (let i = 0; i < size; i++) {
+ * random.push(randomByte())
+ * }
+ * return random
+ * })
+ *
+ * nanoid() //=> "fbaef"
+ * ```
+ *
+ * @param alphabet Alphabet used to generate a random string.
+ * @param size Size of the random string.
+ * @param random A random bytes generator.
+ * @returns A random string generator.
+ */
+export function customRandom(
+ alphabet: string,
+ size: number,
+ random: (bytes: number) => Uint8Array
+): () => string
+
+/**
+ * URL safe symbols.
+ *
+ * ```js
+ * import { urlAlphabet } from 'nanoid'
+ * const nanoid = customAlphabet(urlAlphabet, 10)
+ * nanoid() //=> "Uakgb_J5m9"
+ * ```
+ */
+export const urlAlphabet: string
+
+/**
+ * Generate an array of random bytes collected from hardware noise.
+ *
+ * ```js
+ * import { customRandom, random } from 'nanoid'
+ * const nanoid = customRandom("abcdef", 5, random)
+ * ```
+ *
+ * @param bytes Size of the array.
+ * @returns An array of random bytes.
+ */
+export function random(bytes: number): Uint8Array
diff --git a/node_modules/nanoid/package.json b/node_modules/nanoid/package.json
index 19d7d7a5..4f24d965 100644
--- a/node_modules/nanoid/package.json
+++ b/node_modules/nanoid/package.json
@@ -1,6 +1,6 @@
{
"name": "nanoid",
- "version": "3.3.6",
+ "version": "3.3.7",
"description": "A tiny (116 bytes), secure URL-friendly unique string ID generator",
"keywords": [
"uuid",
@@ -35,31 +35,53 @@
"module": "index.js",
"exports": {
".": {
- "types": "./index.d.ts",
"browser": "./index.browser.js",
- "require": "./index.cjs",
- "import": "./index.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
"default": "./index.js"
},
- "./index.d.ts": "./index.d.ts",
"./package.json": "./package.json",
"./async/package.json": "./async/package.json",
"./async": {
"browser": "./async/index.browser.js",
- "require": "./async/index.cjs",
- "import": "./async/index.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./async/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./async/index.js"
+ },
"default": "./async/index.js"
},
"./non-secure/package.json": "./non-secure/package.json",
"./non-secure": {
- "require": "./non-secure/index.cjs",
- "import": "./non-secure/index.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./non-secure/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./non-secure/index.js"
+ },
"default": "./non-secure/index.js"
},
"./url-alphabet/package.json": "./url-alphabet/package.json",
"./url-alphabet": {
- "require": "./url-alphabet/index.cjs",
- "import": "./url-alphabet/index.js",
+ "require": {
+ "types": "./index.d.cts",
+ "default": "./url-alphabet/index.cjs"
+ },
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./url-alphabet/index.js"
+ },
"default": "./url-alphabet/index.js"
}
}