UNPKG

invoice-craft

Version:

Customizable, browser-first invoice PDF generator library with modern TypeScript API

14 lines (13 loc) 640 B
export function defaultValidate(invoice) { var _a, _b, _c; if (!((_a = invoice.from) === null || _a === void 0 ? void 0 : _a.name)) throw new Error("From (company) name required."); if (!((_b = invoice.to) === null || _b === void 0 ? void 0 : _b.name)) throw new Error("To (client) name required."); if (!((_c = invoice.items) === null || _c === void 0 ? void 0 : _c.length)) throw new Error("At least one invoice item required."); if (!invoice.invoiceNumber) throw new Error("Invoice number required."); if (!invoice.invoiceDate) throw new Error("Invoice date required."); }