UNPKG

@sap-cloud-sdk/core

Version:
24 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSelectV4 = exports.getSelect = void 0; /** * 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 */ function getSelect(selects) { if (selects === void 0) { selects = []; } var selection = selects.map(function (select) { return select._fieldName; }); if (selection.length) { if (selection.find(function (select) { return select.endsWith('*'); })) { return { select: '*' }; } return { select: selection.join(',') }; } return {}; } exports.getSelect = getSelect; exports.getSelectV4 = getSelect; //# sourceMappingURL=get-select.js.map