From b7133c5f962cea093dee557ae716823079157c17 Mon Sep 17 00:00:00 2001 From: Mateusz Rzepa Date: Fri, 13 Sep 2024 16:12:34 +0200 Subject: [PATCH] rid off mapValues --- src/helpers.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index 6f4ed8d..6a53120 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -261,15 +261,12 @@ export const index = function(items = [], fields = []) { * calculates ids for filters */ export const filters_ids = function(facets_data) { - let output = new FastBitSet([]); - - mapValues(facets_data, function(values, key) { - mapValues(facets_data[key], function(facet_indexes, key2) { - output = output.new_union(facets_data[key][key2]); + return Object.values(facets_data).reduce((output, values) => { + Object.values(values).forEach(facet_indexes => { + output = output.new_union(facet_indexes); }); - }); - - return output; + return output; + }, new FastBitSet([])); }; /**