@jiway/firestorm-core - v1.1.1
    Preparing search index...

    Class FirestoreIdBase

    Converter of firestorm ids to integers

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get base(): string

      String containing all the individual digits of the base in order

      Returns string

    • get radix(): number

      Radix of the base (amount of digits in the base)

      Returns number

    Methods

    • Converts a char to its integer value

      Parameters

      • char: string

        Char to convert

      Returns number

      The integer in base 10 represented by the char

    • Compare two strings representing numbers.

      It's a lexicographic comparison meaning that it compares the digits one by one instead of the number represented.

      Parameters

      • lhs: string

        Left number

      • rhs: string

        Right number

      Returns -1 | 0 | 1

      • (-1) : if lhs < right
      • (+1) : if lhs > right
      • 0 : if lhs == right
    • Compare two strings representing numbers.

      Parameters

      • lhs: string

        Left number

      • rhs: string

        Right number

      Returns -1 | 0 | 1

      • (-1) : if lhs < right
      • (+1) : if lhs > right
      • 0 : if lhs == right
    • LERP of a starting number to an ending number

      LERP stands for Linear intERPolation

      Parameters

      • start: string

        Starting number

      • end: string

        Ending number

      • nominator: number

        Nominator of the LERP ratio. Must be an integer

      • denominator: number

        Denominator of the LERP ratio. Must be an integer

      Returns string

      The LERPed value

    • LERP of a starting number to an ending number lexicographically.

      If the two numbers do not have the same amount of chars, it pads them with the lowest value of the base

      LERP stands for Linear intERPolation

      Parameters

      • start: string

        Starting number

      • end: string

        Ending number

      • nominator: number

        Nominator of the LERP ratio. Must be an integer

      • denominator: number

        Denominator of the LERP ratio. Must be an integer

      Returns string

      The LERPed value

    • Converts a string to the integer it represents.

      Parameters

      • str: string

        String to convert

      Returns bigint

      Value of the string

    • Converts an integer to its char value

      Parameters

      • value: number

        Value to convert

      • clamp: boolean = true

        Whether or not to clamp the value to the base if it's out of bound. if unset and out of bound it throws.

      Returns string

      The char representing the value

    • Converts a value to the string representing it in this base

      Parameters

      • value: number | bigint

        Value to convert

      Returns string

      String representing the value