Expand description
Beancount WASM Bindings.
This crate provides WebAssembly bindings for using Beancount from JavaScript/TypeScript.
§Features
- Parse Beancount files
- Validate ledgers
- Run BQL queries
- Format directives
§Example (JavaScript)
import init, { parse, validateSource, query } from '@rustledger/wasm';
await init();
const source = `
2024-01-01 open Assets:Bank USD
2024-01-15 * "Coffee"
Expenses:Food 5.00 USD
Assets:Bank -5.00 USD
`;
const result = parse(source);
if (result.errors.length === 0) {
const validation = validateSource(source);
console.log('Validation errors:', validation.errors);
}Modules§
- types
- Data transfer objects for WASM serialization.
Structs§
- Parsed
Ledger - A parsed and validated ledger that caches the parse result.
Functions§
- balances
- Calculate account balances.
- bql_
completions - Get BQL query completions at cursor position.
- expand_
pads - Process pad directives and expand them.
- format
- Format a Beancount source string.
- init
- Initialize the WASM module.
- list_
plugins - List available native plugins.
- parse
- Parse a Beancount source string.
- query
- Run a BQL query on a Beancount source string.
- run_
plugin - Run a native plugin on the source.
- validate_
source - Validate a Beancount source string.
- version
- Get version information.