UNPKG

@sap-cloud-sdk/odata-common

Version:

SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.

31 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nonEnumerable = void 0; exports.isNavigationProperty = isNavigationProperty; const util_1 = require("@sap-cloud-sdk/util"); /** * Make property non enumerable. * @param target - Object to be adjusted * @param propertyKey - property key which is adjusted. * @internal */ const nonEnumerable = (target, propertyKey) => { const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey) || {}; if (descriptor.enumerable !== false) { descriptor.enumerable = false; descriptor.writable = true; Object.defineProperty(target, propertyKey, descriptor); } }; exports.nonEnumerable = nonEnumerable; /** * Checks if the property with name key of the entity is a navigation property. * @param key - Name of the property. * @param schema - Schema which contains the potential navigation property. * @returns A boolean denoting whether an entity is a navigation property or not. * @internal */ function isNavigationProperty(key, schema) { return !!schema[(0, util_1.upperCaseSnakeCase)(key)]?._linkedEntityApi; } //# sourceMappingURL=properties-util.js.map