@ayanaware/bento
Version:
Modular runtime framework designed to solve complex tasks
24 lines • 921 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parent = exports.getParent = void 0;
const PARENT_KEY = '@ayanaware/bento:ChildOf';
// eslint-disable-next-line @typescript-eslint/ban-types
function getParent(target) {
const parent = Reflect.getMetadata(PARENT_KEY, target);
if (!parent)
return null;
return parent;
}
exports.getParent = getParent;
function Parent(reference) {
return (target, propertyKey) => {
if (!reference)
throw new Error('ChildOf(): EntityReference not provided');
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
if (target.prototype === undefined)
target = target.constructor;
Reflect.defineMetadata(PARENT_KEY, { reference, propertyKey }, target);
};
}
exports.Parent = Parent;
//# sourceMappingURL=Parent.js.map