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.
38 lines (36 loc) • 908 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/line-reason.gen.ts
var PUBLISHED = "Factur-X";
var LINE_REASON = [
{
key: "REGULAR_ITEM_POSITION_STANDARD_CASE",
name: "Regular item position (standard case)",
value: "DETAIL"
},
{ key: "SUBTOTAL_OR_GROUP", name: "Subtotal or group", value: "GROUP" },
{
key: "FOR_INFORMATION_ONLY",
name: "For information only",
value: "INFORMATION"
}
];
var lineReasonCode = LINE_REASON.map(({ value }) => value);
var LineReason = createEnum(LINE_REASON, {
keyProp: "key",
valueProp: "value"
});
export {
LINE_REASON,
LineReason,
PUBLISHED,
lineReasonCode
};