diff --git a/docs/assets/contributors/apottere.svg b/docs/assets/contributors/apottere.svg new file mode 100644 index 0000000..66ce737 --- /dev/null +++ b/docs/assets/contributors/apottere.svg @@ -0,0 +1,11 @@ + + + + + + + + + Andrew Potter + + \ No newline at end of file diff --git a/docs/assets/contributors/bambuchaAdm.svg b/docs/assets/contributors/bambuchaAdm.svg new file mode 100644 index 0000000..994460c --- /dev/null +++ b/docs/assets/contributors/bambuchaAdm.svg @@ -0,0 +1,11 @@ + + + + + + + + + Łukasz Dubiel + + \ No newline at end of file diff --git a/docs/assets/contributors/irfancnk.svg b/docs/assets/contributors/irfancnk.svg new file mode 100644 index 0000000..f36ac37 --- /dev/null +++ b/docs/assets/contributors/irfancnk.svg @@ -0,0 +1,11 @@ + + + + + + + + + Irfan Can Kaleli + + \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index c0979e4..7464f6a 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA6WZ227bOBCG34W5JRJz6PPdtunuBkiaYpP0RjAC2aITYWVJ0SFNYOTdC0qyNWOTKh1dtpl//uF8PInesiz5lbO5t2X/h3HA5jAacxb7G8Xm7O45yYqHOHwp1VXwnx8/qZxxVmYRm7MwLlS29lcqvzCEnT8Xm4hxtor8PFc5mzP2wR0tbvzU0eXGT7uNBrOJGIHZ7FKt/TIqLsNVESaxn4VocMV7euhoCP/cIG9TneDPjWziOk3EAIZ7l2BX2vtJuc+IDtlwlvqZigvbACxl5M/leh2p02poRf0LCNSyfDqxBY2kv3mk4qfi+TT3vaa//SopteNp/q3oUwXIdoFdfvv7r4fr+8eHh6vLx+tv3/+5/3dfyqufhf4yUvmFIapzlhsMbn/cX91+v+tI3kR0Lx+YmtfoPm8jo83rzDkSgGjEeZGVqyLJHDKe0XAHFq6zoNPzBPZuK67D7YR11rXLOVnVcT2cXlWWh0nsYtaG9hzZVRyoN9fh7YJ7elZnqavnLriHZ5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AVnNFKAdmBza56qkEa1E2wdbN9azkqE60QsK2QXBWGXUWiEUrbCHNVmFcJCGRs241y/XFRf1LSsgVSC9tSIepmcwnIr5qoHFSNSzrDHoc66TSerPnduM2ANknbHmnIsPHJnMWdsSZpflRsVYildRYcrQ48YpsKPwggKapS2rpVvTUfL2d0moGtTXqaH28hgBoMNsyGHUugdSmM63LBWRqmKgpjxebe4uPjN64PLU4/IAAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA6WZ227bOBCG34W5FRJz6PPdtunuBkiaYpP0RjAC2qITYWVJ0SFNYOTdC0qyNWOTKh1dtpl//uF8PInesiz5lbO5v2X/h3HA5jAaeyyWG8Xm7O45yYqHOHwp1VXwn4yfVM48VmYRm7MwLlS2liuVXxjCzp+LTcQ8topknquczRn78BwtbmTq6HIj026jwWzCR2A2u1RrWUbFZbgqwiSWWYgGV7ynh46G8M8N8jbVCf7cyCau04QPYLh3CXalvZ+U+4zokI3HUpmpuLANwFJG/lyu15E6rYZW1L+AQC3LpxNb0Ej6m0cqfiqeT3Pfa/rbr5JSO57m34o+VYBoF9jlt7//eri+f3x4uLp8vP72/Z/7f/elvMoslMtI5ReGqM5ZbjC4/XF/dfv9riN5E9G9fGBqXqP7vI2MNq8z54gDohHnRVauiiRzyHhGwx1YuM6CTs8T2LutuA63E9ZZ1y7nZFXH9XB6VVkeJrGLWRvac2RXcaDeXIe3C+7pWZ2lrp674B6eUfJLZV+SMnZZZmckuodrmaYnuJLonv29pkfCHxp8fcJhYB1rGQburiT6NFcYDNsdNFft7ejdxfhQ0Mv7xc3xpbdPqeIilJE+vBwtqaKHe+Y2ebNPzFrqI+Mg2biOkET3cF1vnDb2OqyPT5JtZFGowHWAh4Ie3vJVhpG+qOhUuYv5kaKPe5pmyduNfPui1kmmviZRFLoecR3aHhWtdml+ZMlSLsMoLJy2DouuRyVl9fdY5U5USHQP1ydV/HS/ZpDoPrtYITep0+bVBPbwSmWWqztXQxLd7yz66n4JJ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AA"; \ No newline at end of file diff --git a/docs/classes/ShortUniqueId.html b/docs/classes/ShortUniqueId.html index 1335f17..b1d71dd 100644 --- a/docs/classes/ShortUniqueId.html +++ b/docs/classes/ShortUniqueId.html @@ -7,7 +7,7 @@
const options = { ... };

const uid = new ShortUniqueId(options);

For more information take a look at the ShortUniqueIdOptions type definition.

-

Constructors

Constructors

Properties

Constructors

Properties

counter: number
debug: boolean
dict: string[]
dictIndex: number = 0
dictLength: number = 0
dictRange: number[] = []
lowerBound: number = 0
upperBound: number = 0
uuidLength: number
version: string

Methods

  • Calculates approximate number of hashes before first collision.

    +validate +

Constructors

Properties

counter: number
debug: boolean
dict: string[]
dictIndex: number = 0
dictLength: number = 0
dictRange: number[] = []
lowerBound: number = 0
upperBound: number = 0
uuidLength: number
version: string

Methods

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 8110c7d..03579fd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ NPM Downloads JsDelivr Hits

-

12 Contributors

+

15 Contributors


@@ -142,7 +142,9 @@

Random Color generator

Where $r is random UUID, $s is sequential UUID, and $t is timestamp UUID:

const timestamp = new Date('2023-01-29T03:21:21.000Z');
const result = uid.formattedUUID('Time: $t0 ID: $s2-$r4', timestamp); // timestamp is optional

console.log(result);
// Time: 63d5e631 ID: 0b-aaab
-

Use in CLI

$ npm install --global short-unique-id

$ suid -h

# Usage:
# node short-unique-id [OPTION]
#
# Options:
# -l, --length=ARG character length of the uid to generate.
# -s, --stamp include timestamp in uid (must be used with --length (-l) of 10 or more).
# -t, --timestamp=ARG custom timestamp to parse (must be used along with -s, --stamp, -f, or --format).
# -f, --format=ARG string representing custom format to generate id with.
# -p, --parse=ARG extract timestamp from stamped uid (ARG).
# -d, --dictionaryJson=ARG json file with dictionary array.
# -h, --help display this help +

Ability to validate UUIDs against the instance dictionary or a provided dictionary for improved data integrity and consistency.

+

Example of using .validate() method:

+
// Instantiate using one of the default dictionary strings
const uid = new ShortUniqueId({
dictionary: 'hex',
});

const uuid = uid.stamp(32); // Generate a UUID

// Validate the generated UUID against the instance dictionary
const isValid = uid.validate(uuid);

console.log(`Is the UUID valid? ${isValid}`);
``

### Use in CLI

```sh
$ npm install --global short-unique-id

$ suid -h

# Usage:
# node short-unique-id [OPTION]
#
# Options:
# -l, --length=ARG character length of the uid to generate.
# -s, --stamp include timestamp in uid (must be used with --length (-l) of 10 or more).
# -t, --timestamp=ARG custom timestamp to parse (must be used along with -s, --stamp, -f, or --format).
# -f, --format=ARG string representing custom format to generate id with.
# -p, --parse=ARG extract timestamp from stamped uid (ARG).
# -d, --dictionaryJson=ARG json file with dictionary array.
# -h, --help display this help

Use as module

Add to your project:

// ES6 / TypeScript Import
import ShortUniqueId from 'short-unique-id';

// Node.js require
const ShortUniqueId = require('short-unique-id');

// Deno (web module) Import
import ShortUniqueId from 'https://esm.sh/short-unique-id'; @@ -229,6 +231,11 @@

Random Color generator

💻
📖
+ +
🤔
+
🤔
+
🤔
+ @@ -237,7 +244,7 @@

Random Color generator

License

Copyright (c) 2018-2023 Short Unique ID Contributors.
Licensed under the Apache License 2.0.

-
\ No newline at end of file diff --git a/docs/interfaces/ShortUniqueIdOptions.html b/docs/interfaces/ShortUniqueIdOptions.html index ee29b9b..39ca7ea 100644 --- a/docs/interfaces/ShortUniqueIdOptions.html +++ b/docs/interfaces/ShortUniqueIdOptions.html @@ -1,17 +1,17 @@ ShortUniqueIdOptions | short-unique-id - v5.0.4

Interface ShortUniqueIdOptions

{
dictionary: ['z', 'a', 'p', 'h', 'o', 'd', ...],
shuffle: false,
debug: false,
length: 6,
}

interface ShortUniqueIdOptions {
    counter: number;
    debug: boolean;
    dictionary: string[] | ShortUniqueIdDefaultDictionaries;
    length: number;
    shuffle: boolean;
}

Properties

interface ShortUniqueIdOptions {
    counter: number;
    debug: boolean;
    dictionary: string[] | ShortUniqueIdDefaultDictionaries;
    length: number;
    shuffle: boolean;
}

Properties

counter: number

From 0 to infinity, the current value for the sequential UUID counter

-
debug: boolean

If true the instance will console.log useful info

-
dictionary: string[] | ShortUniqueIdDefaultDictionaries

User-defined character dictionary

-
length: number

From 1 to infinity, the length you wish your UUID to be

-
shuffle: boolean

If true, sequentialUUID use the dictionary in the given order

-
\ No newline at end of file diff --git a/docs/interfaces/ShortUniqueIdRanges.html b/docs/interfaces/ShortUniqueIdRanges.html index 191466b..dd6b905 100644 --- a/docs/interfaces/ShortUniqueIdRanges.html +++ b/docs/interfaces/ShortUniqueIdRanges.html @@ -1,4 +1,4 @@ -ShortUniqueIdRanges | short-unique-id - v5.0.4

Interface ShortUniqueIdRanges

interface ShortUniqueIdRanges {
    [k: string]: [number, number];
}

Indexable

[k: string]: [number, number]

Interface ShortUniqueIdRanges

interface ShortUniqueIdRanges {
    [k: string]: [number, number];
}

Indexable

[k: string]: [number, number]
\ No newline at end of file diff --git a/docs/interfaces/ShortUniqueIdRangesMap.html b/docs/interfaces/ShortUniqueIdRangesMap.html index 17fc8f8..5ffdacf 100644 --- a/docs/interfaces/ShortUniqueIdRangesMap.html +++ b/docs/interfaces/ShortUniqueIdRangesMap.html @@ -1,4 +1,4 @@ -ShortUniqueIdRangesMap | short-unique-id - v5.0.4

Interface ShortUniqueIdRangesMap

interface ShortUniqueIdRangesMap {
    [k: string]: ShortUniqueIdRanges;
}

Indexable

[k: string]: ShortUniqueIdRanges

Interface ShortUniqueIdRangesMap

interface ShortUniqueIdRangesMap {
    [k: string]: ShortUniqueIdRanges;
}

Indexable

[k: string]: ShortUniqueIdRanges
\ No newline at end of file diff --git a/docs/types/ShortUniqueIdDefaultDictionaries.html b/docs/types/ShortUniqueIdDefaultDictionaries.html index 78f877f..0fb642d 100644 --- a/docs/types/ShortUniqueIdDefaultDictionaries.html +++ b/docs/types/ShortUniqueIdDefaultDictionaries.html @@ -1,4 +1,4 @@ -ShortUniqueIdDefaultDictionaries | short-unique-id - v5.0.4

Type alias ShortUniqueIdDefaultDictionaries

ShortUniqueIdDefaultDictionaries: "number" | "alpha" | "alpha_lower" | "alpha_upper" | "alphanum" | "alphanum_lower" | "alphanum_upper" | "hex"

Type alias ShortUniqueIdDefaultDictionaries

ShortUniqueIdDefaultDictionaries: "number" | "alpha" | "alpha_lower" | "alpha_upper" | "alphanum" | "alphanum_lower" | "alphanum_upper" | "hex"
\ No newline at end of file diff --git a/docs/variables/DEFAULT_OPTIONS.html b/docs/variables/DEFAULT_OPTIONS.html index ca52faa..3287da5 100644 --- a/docs/variables/DEFAULT_OPTIONS.html +++ b/docs/variables/DEFAULT_OPTIONS.html @@ -1,4 +1,4 @@ -DEFAULT_OPTIONS | short-unique-id - v5.0.4

Variable DEFAULT_OPTIONSConst

DEFAULT_OPTIONS: ShortUniqueIdOptions = ...

Variable DEFAULT_OPTIONSConst

DEFAULT_OPTIONS: ShortUniqueIdOptions = ...
\ No newline at end of file diff --git a/docs/variables/DEFAULT_UUID_LENGTH.html b/docs/variables/DEFAULT_UUID_LENGTH.html index 6d7301e..8d79058 100644 --- a/docs/variables/DEFAULT_UUID_LENGTH.html +++ b/docs/variables/DEFAULT_UUID_LENGTH.html @@ -5,7 +5,7 @@ as well as the alphabet from a to z both in UPPER and lower case, the probability of generating a duplicate in 1,000,000 rounds is ~0.00000002, or about 1 in 50,000,000.

-
\ No newline at end of file