From e1433f96be717e17ee7ef012958708352687016e Mon Sep 17 00:00:00 2001 From: "Jean M. Lescure" Date: Tue, 30 Apr 2024 11:56:10 -0600 Subject: [PATCH] docs: fix broken links and images --- README.md | 8 ++-- docs/classes/ShortUniqueId.html | 38 +++++++++---------- docs/index.html | 8 ++-- docs/interfaces/ShortUniqueIdOptions.html | 12 +++--- docs/interfaces/ShortUniqueIdRanges.html | 2 +- docs/interfaces/ShortUniqueIdRangesMap.html | 2 +- .../ShortUniqueIdDefaultDictionaries.html | 2 +- docs/variables/DEFAULT_OPTIONS.html | 2 +- docs/variables/DEFAULT_UUID_LENGTH.html | 2 +- src/index.ts | 8 ++-- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index f7e3a7c..3e629d6 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,9 @@ To put this into perspective: You can calculate duplicate/collision probabilities using the included functions: -- [availableUUIDs()](https://shortunique.id/classes/default.html#availableuuids) -- [approxMaxBeforeCollision()](https://shortunique.id/classes/default.html#approxmaxbeforecollision) -- [collisionProbability()](https://shortunique.id/classes/default.html#collisionprobability) +- [availableUUIDs()](https://shortunique.id/classes/ShortUniqueId.html#availableUUIDs) +- [approxMaxBeforeCollision()](https://shortunique.id/classes/ShortUniqueId.html#approxMaxBeforeCollision) +- [collisionProbability()](https://shortunique.id/classes/ShortUniqueId.html#collisionProbability) _NOTE: 👆 On these links you will also find explanations for the math used within the functions._ @@ -306,7 +306,7 @@ function `uniqueness()` which provides a score (from 0 to 1) to rate the to 1, higher the uniqueness and thus better the quality). To find out more about the math behind these functions please refer to the -API Reference. +API Reference. ## Acknowledgement and platform support diff --git a/docs/classes/ShortUniqueId.html b/docs/classes/ShortUniqueId.html index ca3bf14..a404a2a 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.

    +

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.

    Given that:

    • H is the total number of possible UUIDs, or in terms of this library, @@ -45,12 +45,12 @@

      Then Q(H) can be approximated as the square root of the product of half of pi times H:

      - +

      This function returns Q(H).

      (see Poisson distribution)

      -

    Parameters

    • rounds: number = ...

    Returns number

  • Calculates total number of possible UUIDs.

    +

    Parameters

    • rounds: number = ...

    Returns number

  • Calculates total number of possible UUIDs.

    Given that:

    • H is the total number of possible UUIDs
    • @@ -59,11 +59,11 @@

    Then H is defined as n to the power of l:

    - +

    This function returns H.

    -

    Parameters

    • uuidLength: number = ...

    Returns number

  • Calculates probability of generating duplicate UUIDs (a collision) in a +

    Parameters

    • uuidLength: number = ...

    Returns number

  • Calculates probability of generating duplicate UUIDs (a collision) in a given number of UUID generation rounds.

    Given that:

      @@ -75,29 +75,29 @@

      Then the probability of collision p(r; H) can be approximated as the result of dividing the square root of the product of half of pi times r by H:

      - +

      This function returns p(r; H).

      (see Poisson distribution)

      (Useful if you are wondering "If I use this lib and expect to perform at most r rounds of UUID generations, what is the probability that I will hit a duplicate UUID?".)

      -

    Parameters

    • rounds: number = ...
    • uuidLength: number = ...

    Returns number

  • Parameters

    • format: string
    • Optional date: Date

    Returns string

  • Generates custom UUID with the provided format string.

    +

    Parameters

    • rounds: number = ...
    • uuidLength: number = ...

    Returns number

  • Parameters

    • format: string
    • Optional date: Date

    Returns string

  • Generates custom UUID with the provided format string.

    Parameters

    • format: string
    • Optional date: Date

    Returns string

    Alias

    const uid = new ShortUniqueId(); uid.fmt(format: string);

    -
  • Return the version of this module.

    -

    Returns string

  • Extracts the date embeded in a UUID generated using the uid.stamp(finalLength); method.

    +
  • Return the version of this module.

    +

    Returns string

  • Extracts the date embeded in a UUID generated using the uid.stamp(finalLength); method.

     const uidWithTimestamp = uid.stamp(32);
    console.log(uidWithTimestamp);
    // GDa608f973aRCHLXQYPTbKDbjDeVsSb3

    console.log(uid.parseStamp(uidWithTimestamp));
    // 2021-05-03T06:24:58.000Z
    -

    Parameters

    • suid: string
    • Optional format: string

    Returns Date

  • Generates UUID by creating each part randomly.

    +

    Parameters

    • suid: string
    • Optional format: string

    Returns Date

  • Generates UUID by creating each part randomly.

    Parameters

    • uuidLength: number = ...

    Returns string

    Alias

    const uid = new ShortUniqueId(); uid.rnd(uuidLength: number);

    -
  • Parameters

    • uuidLength: number = ...

    Returns string

  • Generates UUID based on internal counter that's incremented after each ID generation.

    +
  • Parameters

    • uuidLength: number = ...

    Returns string

  • Generates UUID based on internal counter that's incremented after each ID generation.

    Returns string

    Alias

    const uid = new ShortUniqueId(); uid.seq();

    -
  • Set the counter to a specific value.

    -

    Parameters

    • counter: number

    Returns void

  • Generates a UUID with a timestamp that can be extracted using uid.parseStamp(stampString);.

    +
  • Set the counter to a specific value.

    +

    Parameters

    • counter: number

    Returns void

  • Generates a UUID with a timestamp that can be extracted using uid.parseStamp(stampString);.

     const uidWithTimestamp = uid.stamp(32);
    console.log(uidWithTimestamp);
    // GDa608f973aRCHLXQYPTbKDbjDeVsSb3

    console.log(uid.parseStamp(uidWithTimestamp));
    // 2021-05-03T06:24:58.000Z
    -

    Parameters

    • finalLength: number
    • Optional date: Date

    Returns string

  • Calculate a "uniqueness" score (from 0 to 1) of UUIDs based on size of +

    Parameters

    • finalLength: number
    • Optional date: Date

    Returns string

  • Calculate a "uniqueness" score (from 0 to 1) of UUIDs based on size of dictionary and chosen UUID length.

    Given that:

      @@ -110,13 +110,13 @@ generating a "word" I had previously generated (a duplicate) at any given iteration up to the the total number of possible UUIDs expressed as the quotiend of Q(H) and H:

      - +

      (Useful if you need a value to rate the "quality" of the combination of given dictionary and UUID length. The closer to 1, higher the uniqueness and thus better the quality.)

      -

    Parameters

    • rounds: number = ...

    Returns number

  • Validate given UID contains only characters from the instanced dictionary or optionally provided dictionary.

    -

    Parameters

    Returns boolean

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index bfb38a0..064af9a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -99,9 +99,9 @@

Random Color generator

You can calculate duplicate/collision probabilities using the included functions:

NOTE: 👆 On these links you will also find explanations for the math used within the functions.


@@ -181,7 +181,7 @@

Random Color generator

"quality" of the combination of given dictionary and UUID length (the closer to 1, higher the uniqueness and thus better the quality).

To find out more about the math behind these functions please refer to the -API Reference.

+API Reference.

Acknowledgement and platform support

This repo and npm package started as a straight up manual transpilation to ES6 of the short-uid npm package by Ankit Kuwadekar.

image depicting over 200000 weekly npm downloads image depicting over 16000000 weekly cdn hits

diff --git a/docs/interfaces/ShortUniqueIdOptions.html b/docs/interfaces/ShortUniqueIdOptions.html index 795e1e4..4db9f13 100644 --- a/docs/interfaces/ShortUniqueIdOptions.html +++ b/docs/interfaces/ShortUniqueIdOptions.html @@ -1,17 +1,17 @@ ShortUniqueIdOptions | short-unique-id - v5.1.1

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 725db59..f2be623 100644 --- a/docs/interfaces/ShortUniqueIdRanges.html +++ b/docs/interfaces/ShortUniqueIdRanges.html @@ -1,4 +1,4 @@ -ShortUniqueIdRanges | short-unique-id - v5.1.1

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 1496b97..294dd02 100644 --- a/docs/interfaces/ShortUniqueIdRangesMap.html +++ b/docs/interfaces/ShortUniqueIdRangesMap.html @@ -1,4 +1,4 @@ -ShortUniqueIdRangesMap | short-unique-id - v5.1.1

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 d4f287e..b1f0702 100644 --- a/docs/types/ShortUniqueIdDefaultDictionaries.html +++ b/docs/types/ShortUniqueIdDefaultDictionaries.html @@ -1,4 +1,4 @@ -ShortUniqueIdDefaultDictionaries | short-unique-id - v5.1.1

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 e903db4..ebec5a6 100644 --- a/docs/variables/DEFAULT_OPTIONS.html +++ b/docs/variables/DEFAULT_OPTIONS.html @@ -1,4 +1,4 @@ -DEFAULT_OPTIONS | short-unique-id - v5.1.1

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 e415dbd..90917fe 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 diff --git a/src/index.ts b/src/index.ts index b8e33b8..7b6c2d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -372,7 +372,7 @@ export default class ShortUniqueId { * Then `H` is defined as `n` to the power of `l`: * *
- * + * *
* * This function returns `H`. @@ -397,7 +397,7 @@ export default class ShortUniqueId { * of pi times `H`: * *
- * + * *
* * This function returns `Q(H)`. @@ -425,7 +425,7 @@ export default class ShortUniqueId { * of dividing the square root of the product of half of pi times `r` by `H`: * *
- * + * *
* * This function returns `p(r; H)`. @@ -462,7 +462,7 @@ export default class ShortUniqueId { * up to the the total number of possible UUIDs expressed as the quotiend of `Q(H)` and `H`: * *
- * + * *
* * (Useful if you need a value to rate the "quality" of the combination of given dictionary