beancount
    Preparing search index...

    Function parse

    • Parses a complete Beancount file string into a ParseResult containing Node objects.

      This is the main entry point for parsing Beancount files. It handles:

      • Splitting the source into source fragment
      • Parsing each source fragment into its appropriate node
      • Managing the tag stack for pushtag/poptag nodes
      • Applying tags from the stack to transactions

      Parameters

      • source: string

        The complete Beancount file content as a string

      Returns ParseResult

      A ParseResult instance containing all parsed nodes

      This is the primary function you'll use from this library. It takes a Beancount file as a string and returns a structured ParseResult object containing the resulting parsed nodes.

      Basic usage:

      import { parse } from 'beancount'

      const content = `
      2024-01-01 open Assets:Checking
      2024-01-02 * "Payee" "Narration"
      Assets:Checking 100.00 USD
      Income:Salary -100.00 USD
      `

      const result = parse(content)
      // result.nodes contains parsed Node objects