UNPKG

@sphereon/ssi-sdk.data-store

Version:

18 lines 721 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseAndValidateOrderOptions = void 0; const parseAndValidateOrderOptions = (order) => { const orderPairs = order.split(',').map((pair) => pair.trim().split('.')); const orderOptions = {}; orderPairs.forEach(([field, direction]) => { const dir = direction.toUpperCase(); if (dir !== 'ASC' && dir !== 'DESC') { throw new Error(`Invalid order direction: '${direction}'. Must be 'asc' or 'desc'.`); } ; orderOptions[field] = dir; }); return orderOptions; }; exports.parseAndValidateOrderOptions = parseAndValidateOrderOptions; //# sourceMappingURL=SortingUtils.js.map