Repository URL to install this package:
|
Version:
0.0.15 ▾
|
// then we do not write-on-read
const defaultValue = {
name: 'All',
isSelected: true,
};
/**
* @hack @@demo @rue21 transformedDropDown scoped for @@perf
* ^ I think `SelectDropDown` makes duplicates
*
* @todo isn't this just filter?
* this is to hide the default value?
* or is it to filter categories without children?
* @todo should be in state
* @todo should put hiding currently selected option from dropdown in select dropdown
*/
let transformedDropDown = undefined;
function toDropDownCategories(categoryList) {
if (transformedDropDown !== undefined) {
return transformedDropDown;
}
transformedDropDown = categoryList
.filter(item => item.categories.length)
.slice(0)
.concat([defaultValue])
.map(item => {
// "name" is so 2017
item.label = item.name;
return item;
});
}
export { toDropDownCategories };
//# sourceMappingURL=deps.js.map