node-zugferd
Version:
A Node.js library for creating ZUGFeRD/Factur-X compliant documents. Generating XML and embedding it into PDF/A files, enabling seamless e-invoicing and digital document compliance.
32 lines (30 loc) • 797 B
JavaScript
// src/codelists/index.ts
var getByPath = (obj, path) => path.split(".").reduce((acc, key) => acc?.[key], obj);
var createEnum = (data, options) => {
return Object.fromEntries(
data.map((item) => [
getByPath(item, options.keyProp),
getByPath(item, options.valueProp)
])
);
};
// src/codelists/time.gen.ts
var TIME = [
{ key: "DATE_OF_INVOICE", name: "Date of invoice", value: "5" },
{
key: "DATE_OF_DELIVERY_OF_GOODS_TO_ESTABLISHMENTSDOMICILESITE",
name: "Date of delivery of goods to establishments/domicile/site",
value: "29"
},
{ key: "PAYMENT_DATE", name: "Payment date", value: "72" }
];
var timeCode = TIME.map(({ value }) => value);
var Time = createEnum(TIME, {
keyProp: "key",
valueProp: "value"
});
export {
TIME,
Time,
timeCode
};