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

    Interface ExpressionFactory<T>

    A feature factory tied to one numeric adapter and a snapshot of its language configuration.

    interface ExpressionFactory<T> {
        constants: readonly ExpressionConstantMetadata[];
        functions: readonly ExpressionFunctionMetadata[];
        compile(source: string): CompiledExpression<T>;
        evaluate(
            source: string,
            bindings?: Readonly<Record<string, NumericInput<T>>>,
        ): T;
        parse(source: string): ExpressionNode;
        tryEvaluate(
            source: string,
            bindings?: Readonly<Record<string, NumericInput<T>>>,
        ): ExpressionResult<T>;
    }

    Type Parameters

    • T
    Index
    constants: readonly ExpressionConstantMetadata[]

    Frozen descriptors sorted by name. Inspecting them does not calculate constant values.

    functions: readonly ExpressionFunctionMetadata[]

    Frozen descriptors sorted by name, including unavailable built-ins and custom registrations.

    • Parameters

      • source: string

      Returns CompiledExpression<T>

    • Parameters

      • source: string
      • Optionalbindings: Readonly<Record<string, NumericInput<T>>>

      Returns T

    • Syntax only: does not resolve function names, constants or variables.

      Parameters

      • source: string

      Returns ExpressionNode

    • Parameters

      • source: string
      • Optionalbindings: Readonly<Record<string, NumericInput<T>>>

      Returns ExpressionResult<T>