@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.
23 lines (22 loc) • 614 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.differentFromEmptyString = void 0;
/**
*
* @param value The result of {@link URLSearchParams.getAll getAll}
* @param result The {@link ODataQuery} to append the error to
* @returns {boolean} Returns `false` when the parse has an error
*/
const differentFromEmptyString = (value, result) => {
if (value[0] === '') {
result.error = {
code: '0x80040203',
message: 'Expected non-empty string.'
};
return false;
}
return true;
};
exports.differentFromEmptyString = differentFromEmptyString;