UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

25 lines 663 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseSort = exports.stringifySort = void 0; const stringifySort = (sort) => { return Object .keys(sort) .map(key => { return `${key}:${sort[key]}`; }) .join(","); }; exports.stringifySort = stringifySort; const parseSort = (sort) => { if (typeof sort === "undefined") { return undefined; } return sort .split(",") .reduce((pV, cV) => { pV[cV.split(":")[0]] = cV.split(":")[1] === "desc" ? -1 : 1; return pV; }, {}); }; exports.parseSort = parseSort; //# sourceMappingURL=sort.js.map