@cognigy/rest-api-client
Version:
Cognigy REST-Client
20 lines • 478 B
JavaScript
export const stringifySort = (sort) => {
return Object
.keys(sort)
.map(key => {
return `${key}:${sort[key]}`;
})
.join(",");
};
export 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;
}, {});
};
//# sourceMappingURL=sort.js.map