@neutrium/quantity - v7.1.0
    Preparing search index...

    Class QuantityParseError

    An expression parsing failure located in the original input. offset uses zero-based UTF-16 indices; line and column are one-based. Use code for application logic and message for a source line with a caret. Quantity's dimensional and temperature validation errors are separate.

    import { Quantity } from '@neutrium/quantity';
    import { QuantityParseError } from '@neutrium/quantity/parsers/pratt';
    try
    {
    new Quantity('kg/(m*s');
    }
    catch (error)
    {
    if (error instanceof QuantityParseError)
    {
    error.code; // "UNEXPECTED_END"
    error.input; // "kg/(m*s"
    }
    }

    Hierarchy

    • SyntaxError
      • QuantityParseError
    Index
    • Parameters

      • code: QuantityParseErrorCode

        Stable category suitable for application logic.

      • input: string

        Original expression, without Unicode or whitespace normalization.

      • offset: number

        Zero-based UTF-16 index of the error, or input.length for missing input.

      • reason: string
      • expected: readonly string[] = []

        Expected token hints when available; empty for evaluation failures.

      Returns QuantityParseError

    cause?: unknown

    Stable category suitable for application logic.

    column: number

    One-based UTF-16 column in the original input.

    expected: readonly string[] = []

    Expected token hints when available; empty for evaluation failures.

    input: string

    Original expression, without Unicode or whitespace normalization.

    line: number

    One-based line in the original input.

    message: string
    name: string
    offset: number

    Zero-based UTF-16 index of the error, or input.length for missing input.

    stack?: string