hledger compiled to WebAssembly for browser use
npm install hledger-wasmhledger compiled to WebAssembly for running in the browser.
``javascript
import { init, accounts, balance, print, aregister, commodities } from 'hledger-wasm';
await init();
const journal =
2024-01-01 Opening
assets:bank 1000 USD
equity:opening;
const accountList = await accounts(journal);
const balances = await balance(journal);
`
All functions take journal content as a string and return Promises.
- init() - Initialize the WASM module (call once)accounts(journal)
- - Get account names as string[]print(journal)
- - Get transactions as objectsbalance(journal)
- - Get balances as [accountName, amounts][]aregister(journal, account)
- - Get transactions for an accountcommodities(journal)
- - Get commodity names as string[]
The bridge automatically exposes these functions on window.hledgerWasm`.