UNPKG

@shko.online/dataverse-odata

Version:

This package will help parse OData strings (only the Microsoft Dataverse subset). It can be used as a validator, or you can build some javascript library which consumes the output of this library.

27 lines (25 loc) 690 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSelectFromParser = void 0; var _atMostOnce = require("./validators/atMostOnce"); const option = '$select'; /** * Parses the {@link ODataSelect.$select $select} query * @returns {boolean} Returns `false` when the parse has an error */ const getSelectFromParser = (parser, result) => { const value = parser.getAll(option); if (value.length === 0) { return true; } if (!(0, _atMostOnce.atMostOnce)(option, value, result)) { return false; } if (value.length > 0) { result.$select = value[0].split(','); } return true; }; exports.getSelectFromParser = getSelectFromParser;