hledger-wasm
v0.1.0
Published
hledger compiled to WebAssembly for browser use
Maintainers
Readme
hledger-wasm
hledger compiled to WebAssembly for running in the browser.
Usage
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);API
All functions take journal content as a string and return Promises.
init()- Initialize the WASM module (call once)accounts(journal)- Get account names asstring[]print(journal)- Get transactions as objectsbalance(journal)- Get balances as[accountName, amounts][]aregister(journal, account)- Get transactions for an accountcommodities(journal)- Get commodity names asstring[]
window.hledgerWasm
The bridge automatically exposes these functions on window.hledgerWasm.
