Files
node_modules
.bin
@alloc
@jridgewell
@mapbox
@nodelib
@tailwindcss
@types
abbrev
accepts
adm-zip
agent-base
ansi-regex
ansi-styles
any-promise
anymatch
aproba
are-we-there-yet
arg
array-flatten
async
balanced-match
bcrypt
binary-extensions
body-parser
brace-expansion
braces
bson
bytes
call-bind
camelcase-css
cassandra-driver
chalk
chokidar
chownr
color-convert
color-name
color-support
commander
concat-map
console-control-strings
content-disposition
content-type
cookie
cookie-parser
cookie-signature
cssesc
debug
delegates
depd
destroy
detect-libc
didyoumean
dlv
ee-first
ejs
emoji-regex
encodeurl
escape-html
etag
express
express-session
fast-glob
fastq
filelist
fill-range
finalhandler
forwarded
fresh
fs
fs-minipass
fs.realpath
fsevents
function-bind
gauge
get-intrinsic
glob
glob-parent
has
has-flag
has-proto
has-symbols
has-unicode
http-errors
https-proxy-agent
iconv-lite
inflight
inherits
ip
ipaddr.js
is-binary-path
is-core-module
is-extglob
is-fullwidth-code-point
is-glob
is-number
jake
jiti
lilconfig
lines-and-columns
long
lru-cache
make-dir
media-typer
memory-pager
merge-descriptors
merge2
methods
micromatch
mime
mime-db
mime-types
mini-svg-data-uri
minimatch
minipass
minizlib
mkdirp
mongodb
mongodb-connection-string-url
ms
mz
nanoid
async
bin
non-secure
url-alphabet
LICENSE
README.md
index.browser.cjs
index.browser.js
index.cjs
index.d.ts
index.js
nanoid.js
package.json
negotiator
node-addon-api
node-fetch
nopt
normalize-path
npmlog
object-assign
object-hash
object-inspect
on-finished
on-headers
once
parseurl
path-is-absolute
path-parse
path-to-regexp
picocolors
picomatch
pify
pirates
postcss
postcss-import
postcss-js
postcss-less
postcss-load-config
postcss-nested
postcss-selector-parser
postcss-value-parser
proxy-addr
punycode
qs
queue-microtask
random-bytes
range-parser
raw-body
read-cache
readable-stream
readdirp
resolve
reusify
rimraf
run-parallel
safe-buffer
safer-buffer
saslprep
semver
send
serve-static
set-blocking
setprototypeof
side-channel
signal-exit
smart-buffer
socks
source-map
source-map-js
sparse-bitfield
statuses
string-width
string_decoder
strip-ansi
sucrase
supports-color
supports-preserve-symlinks-flag
tailwindcss
tar
thenify
thenify-all
to-regex-range
toidentifier
tr46
ts-interface-checker
type-is
uid-safe
unpipe
util-deprecate
utils-merge
vary
webidl-conversions
whatwg-url
wide-align
wrappy
yallist
yaml
.package-lock.json
public
views
Title.html
cat.gif
index.css
index.html
package-lock.json
package.json
result.js
tailwind.config.js
glink-website/node_modules/nanoid/index.d.ts
2023-06-21 15:56:08 -05:00

92 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 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