@aptly-as/types
Version:
Aptly types and enums
34 lines (33 loc) • 1.05 kB
JavaScript
export var AptlyItemType;
(function (AptlyItemType) {
AptlyItemType["Physical"] = "physical";
AptlyItemType["Digital"] = "digital";
AptlyItemType["Service"] = "service";
AptlyItemType["Resource"] = "resource";
AptlyItemType["Material"] = "material";
AptlyItemType["Category"] = "category";
AptlyItemType["Package"] = "package";
AptlyItemType["PackageEnd"] = "package-end";
})(AptlyItemType || (AptlyItemType = {}));
export const AptlyItemOptionTypes = [
AptlyItemType.Physical,
AptlyItemType.Digital,
AptlyItemType.Service,
AptlyItemType.Resource,
AptlyItemType.Material,
];
export const AptlyItemGroupTypes = [
AptlyItemType.Package,
AptlyItemType.Category,
];
export const AptlyItemEndTypes = [AptlyItemType.PackageEnd];
export function aptlyItemPack(option, pack) {
if (option.type === AptlyItemType.Package) {
return option;
}
if (option.type === AptlyItemType.Category ||
option.type === AptlyItemType.PackageEnd) {
return null;
}
return pack;
}