@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
27 lines • 927 B
JavaScript
import { RelationRole } from "../contracts/base";
export class RelationRoleMapper {
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
static mapToEnumValue(value) {
if (value.toLowerCase() === "parent") {
return RelationRole.Parent;
}
else if (value.toLowerCase() === "child") {
return RelationRole.Child;
}
else {
throw Error(`Can't map '${value}' to enum value.`);
}
}
static mapToType(value) {
if (value === RelationRole.Parent || value === RelationRole[RelationRole.Parent]) {
return "Parent";
}
else if (value === RelationRole.Child || value === RelationRole[RelationRole.Child]) {
return "Child";
}
else {
throw Error(`Can't map '${value} to type.`);
}
}
}
//# sourceMappingURL=relation-role-mapper.js.map