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.
37 lines (35 loc) • 910 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/date.gen.ts
var DATE = [
{
key: "CCYYMMDD",
name: "CCYYMMDD",
value: "102",
description: "Calendar date: C = Century ; Y = Year ; M = Month ; D = Day."
},
{
key: "CCYYMMDDHHMMZHHMM",
name: "CCYYMMDDHHMMZHHMM",
value: "205",
description: "Calendar date including time and time zone expressed in hours and minutes.\nZHHMM = time zone given as offset from Coordinated Universal Time (UTC)."
}
];
var dateCode = DATE.map(({ value }) => value);
var Date = createEnum(DATE, {
keyProp: "key",
valueProp: "value"
});
export {
DATE,
Date,
dateCode
};