From 33f2d2de597157c02baf300091e1297ba8efe0da Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Tue, 9 Aug 2022 18:33:19 +0200 Subject: [PATCH] feat(assist): handle nested response --- utilities/utils/helper.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utilities/utils/helper.js b/utilities/utils/helper.js index b012ccf6c..22fcd0fd5 100644 --- a/utilities/utils/helper.js +++ b/utilities/utils/helper.js @@ -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");