beancount
    Preparing search index...

    Class Value

    Represents a typed value in Beancount (used in metadata, expressions, etc.). Handles string, boolean, date, amount, and number values.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Creates a new Value instance.

      Parameters

      • obj: { type: ValueType; value: unknown }

        Object containing type and value properties

        • type: ValueType

          The value type

        • value: unknown

          The value data

      Returns Value

    Properties

    type: ValueType

    The type of this value

    value: unknown

    The actual value data

    Methods

    • Converts this value to its string representation. Formats based on type:

      • Booleans as TRUE/FALSE
      • Strings with surrounding quotes
      • Other types as their string representation

      Returns string

      The formatted string representation

    • Parses a string into a Value object with appropriate type detection. Detects and handles:

      • Quoted strings
      • Boolean values (TRUE/FALSE, case-insensitive)
      • Amounts (fallback for other values)

      Parameters

      • input: string

        The string to parse

      Returns Value

      A new Value instance with detected type