Maybe if Beancount gets rewritten in Rust we can compile it to Rust-WASM and run it in the browser, haha!
On Thu, Feb 8, 2024 at 10:14 AM base hamster <[email protected]> wrote: > The biggest benefit is that it makes beancount Turing-complete, so you can > use typescript to write recurring bills. > > > import { EAccountType, Ledger, utils } from "../index.js"; > > const { USD, CNY } = utils.createCurrencies({ defaultDate: "1970-10-01" }, > [ > "USD", > "CNY", > ] as const); > > const Assets = utils.buildAccountHierarchy(USD, EAccountType.Assets, { > CN: { > Cash: utils.createAccountNodeConfig({ open: "1970-01-01", currency: > CNY }), > }, > Cash: utils.createAccountNodeConfig({ open: "1970-01-01" }), > UTrade: { > Account: { > AAPL: utils.createAccountNodeConfig({ open: "1970-01-01" }), > EWJ: utils.createAccountNodeConfig({ open: "1970-01-01" }), > }, > }, > }); > > const Expenses = utils.buildAccountHierarchy(USD, EAccountType.Expenses, { > Food: { > Groceries: utils.createAccountNodeConfig({ open: "1970-01-01" }), > Alcool: utils.createAccountNodeConfig({ open: "1970-01-01" }), > }, > }); > > const ledger = new Ledger( > [ > ...utils.flattenAccountHierarchy(Assets), > ...utils.flattenAccountHierarchy(Expenses), > ], > [USD, CNY] > ); > > const { tr } = utils.transactionBuilder(ledger); > > tr( > "1970-01-01", > "Distribution of cash expenses", > Assets.Cash.posting(-300), > Expenses.Food.Alcool.posting(300) > ); > > console.log(utils.beanCount.serializationLedger(ledger)); > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/a52e830a-de80-484e-8ad3-c6fe4f444409n%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/a52e830a-de80-484e-8ad3-c6fe4f444409n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhPbmg2az7r0CX%2BUkgsB0TMDPbykqAeoX%3DGJHcxpRdnG0Q%40mail.gmail.com.
