Class Staquia

Hierarchy

  • Staquia

Constructors

Properties

Accessors

Methods

Constructors

Properties

#system: NumberSystem

Sytem used to forge positions

Accessors

Methods

  • Creates a new position based on the current number system

    Example

    import { staquia } from "staquia";

    // You can create the position just like this
    const position = staquia.position("nnnnzzzz");

    // If you need it, you can get the object representation
    const object = position.toObject();

    // Or the string representation from your position
    const string = position.toString();

    // You can compare the instances with the less than '<',
    // greater than '>' or equal '=' operators
    staquia.position("a") < staquia.position("b")

    Parameters

    • Optional value: PositionValue

      The reference string or object to create a position

    Returns Position

  • Updates the staquia settings such as the number system values or the threshold and overflow handlers

    Example

    // An odd base (like 27th [a-z]) should be used with a zero character
    // smaller than any value of the set (like [!])
    const zero = "!";
    const first = "a";
    const last = "z";

    // Segments for the position algorithm, that defines the length from the system
    const segments = { n: 4, z: 12 }

    // ϰ (kappa) Helps to set a threshold to fire events to handle possible overflows
    const ϰ = 0.15;

    Parameters

    • Optional settings: StaquiaSettings

      The settings object to configure staquia

    Returns void

  • Creates a recommended start position to depart, to have the most possible position forges before an overflow

    Example

    import { staquia } from "staquia";

    // For instance if the middle character in the system is 'n'
    // and the 'n' segment length is 5, the recommended position
    // would be "nnnnn"
    const nnnnn = staquia.start();

    Returns Position

Generated using TypeDoc