Staquia API
    Preparing search index...

    Class ThresholdReachedError

    Returned (never thrown) when a new position reaches the threshold length lϰ = ceil((1 - fϰ) * lmax): an early warning before the overflow.

    The position is still valid and comes inside the error (error.position), so it can be used, but it is time to space the positions again (LexicalList.sort).

    import Staquia, { ThresholdReachedError } from "staquia";

    // lϰ = ceil((1 - 0.15) * 20) = 17
    const system = Staquia.create("!", "a", "z", 5, 15, 0.15);

    const result = system.forge("mmmmmmmmmmmmmmmmm"); // 17 characters
    if (!result.ok && result.error instanceof ThresholdReachedError) {
    // Still valid: use it, and rebalance soon
    console.log(result.error.position.toString()); // "mmmmmmmmmmmmmmmmm"
    }

    Hierarchy

    • Error
      • ThresholdReachedError
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    cause?: unknown
    message: string
    name: string
    stack?: string

    Accessors

    Methods

    • Indicates whether the argument provided is a built-in Error instance or not.

      Parameters

      • error: unknown

      Returns error is Error