UNPKG

@sap-cloud-sdk/odata-v4

Version:

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

22 lines 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSelect = getSelect; /** * Get an object containing the given Selectables as query parameter, or an empty object if none were given. * In OData v4 selected properties are not automatically expanded anymore and a manual expand needs to be performed. * @typeParam EntityT - Type of the entity to get the selection for * @param selects - The list of selectables to be transformed to query parameters * @returns An object containing the query parameters or an empty object * @internal */ function getSelect(selects = []) { const selection = selects.map(select => select._fieldName); if (selection.length) { if (selection.find(select => select.endsWith('*'))) { return { select: '*' }; } return { select: selection.join(',') }; } return {}; } //# sourceMappingURL=get-select.js.map