feat(assist): handle nested response

This commit is contained in:
Taha Yassine Kraiem 2022-08-09 18:33:19 +02:00
parent 738217d979
commit 33f2d2de59

View file

@ -174,6 +174,13 @@ const getValue = function (obj, key) {
return undefined;
}
const sortPaginate = function (list, filters) {
if (typeof (list) === "object" && !Array.isArray(list)) {
for (const [key, value] of Object.entries(list)) {
list[key] = sortPaginate(value, filters);
}
return list
}
const total = list.length;
list.sort((a, b) => {
const tA = getValue(a, "timestamp");