debian-mirror-gitlab/app/assets/javascripts/search/sidebar/utils.js

18 lines
442 B
JavaScript
Raw Normal View History

2023-06-20 00:43:36 +05:30
import { languageFilterData } from '~/search/sidebar/components/language_filter/data';
2023-04-23 21:23:45 +05:30
2023-05-27 22:25:52 +05:30
export const convertFiltersData = (rawBuckets) =>
rawBuckets.reduce(
(acc, bucket) => ({
...acc,
filters: {
...acc.filters,
[bucket.key.toUpperCase()]: {
label: bucket.key,
value: bucket.key,
count: bucket.count,
2023-04-23 21:23:45 +05:30
},
2023-05-27 22:25:52 +05:30
},
}),
2023-04-23 21:23:45 +05:30
{ ...languageFilterData, filters: {} },
);