@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
31 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RelationRoleMapper = void 0;
const base_1 = require("../contracts/base");
class RelationRoleMapper {
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
static mapToEnumValue(value) {
if (value.toLowerCase() === "parent") {
return base_1.RelationRole.Parent;
}
else if (value.toLowerCase() === "child") {
return base_1.RelationRole.Child;
}
else {
throw Error(`Can't map '${value}' to enum value.`);
}
}
static mapToType(value) {
if (value === base_1.RelationRole.Parent || value === base_1.RelationRole[base_1.RelationRole.Parent]) {
return "Parent";
}
else if (value === base_1.RelationRole.Child || value === base_1.RelationRole[base_1.RelationRole.Child]) {
return "Child";
}
else {
throw Error(`Can't map '${value} to type.`);
}
}
}
exports.RelationRoleMapper = RelationRoleMapper;
//# sourceMappingURL=relation-role-mapper.js.map