in src/components/base/new_dropdowns/listbox/listbox.stories.js [387:418]
computedItems() {
const isSelected = (option) => this.selected.includes(option.value);
const notSelected = (option) => !isSelected(option);
// eslint-disable-next-line unicorn/no-array-callback-reference
const selectedBranches = mockGroups[0].options.filter(isSelected);
// eslint-disable-next-line unicorn/no-array-callback-reference
const availableBranches = mockGroups[0].options.filter(notSelected);
// eslint-disable-next-line unicorn/no-array-callback-reference
const selectedTags = mockGroups[1].options.filter(isSelected);
// eslint-disable-next-line unicorn/no-array-callback-reference
const availableTags = mockGroups[1].options.filter(notSelected);
return [
{
text: 'Selected branches',
options: selectedBranches,
},
{
text: 'Selected tags',
options: selectedTags,
},
{
text: 'Branches',
options: availableBranches,
},
{
text: 'Tags',
options: availableTags,
},
].filter((group) => group.options.length);
},