@elsikora/nestjs-crud-automator
Version:
A library for automating the creation of CRUD operations in NestJS.
21 lines (19 loc) • 720 B
JavaScript
/**
* Finds the nearest own descriptor for a property across an object's prototype chain.
* @param {object} source - Object whose chain is inspected.
* @param {PropertyKey} key - Property key to resolve.
* @returns {PropertyDescriptor | undefined} Nearest descriptor, if present.
*/
function ObjectFindPropertyDescriptor(source, key) {
let current = source;
while (current) {
const descriptor = Object.getOwnPropertyDescriptor(current, key);
if (descriptor) {
return descriptor;
}
current = Object.getPrototypeOf(current);
}
return undefined;
}
export { ObjectFindPropertyDescriptor };
//# sourceMappingURL=object-find-property-descriptor.utility.js.map