Something went wrong. Try again.
Convert CSV banking statements to hledger journals
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233// A rule as its fields show it (M1-UI-008), and as its folded line reads// (D10, §6.5 of DESIGN_M1.md).
// The fields, in the order a card shows them. An optional field's empty box// means "not set" rather than an empty value: a source account with no name is// not an account.export const FIELDS = [ { key: "name", label: "name" }, { key: "targetAccount", label: "target account" }, { key: "sourceAccount", label: "source account (optional)", optional: true }, { key: "match", label: "matches when", multiline: true, completes: true },];
// A rule with every box empty.export const emptyRule = () => Object.fromEntries(FIELDS.map((field) => [field.key, field.optional ? null : ""]));
// What a field's box shows for a rule's value.export const shown = (value) => (value === null ? "" : value);
// What a field's box means as the rule's value.export const valueOf = (field, text) => (field.optional && text === "" ? null : text);
// The line a folded rule shows. Open, the card shows only the name, since the// fields below it say the rest; app.css decides that.export function lineOf(rule) { return { match: rule.match, name: rule.name === "" ? "(unnamed rule)" : rule.name, target: rule.targetAccount, };}