Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
findFilterLabelByType(filter, appliedFilter) {
let appliedFilterValue = get(appliedFilter, 'value');
if (get(filter, 'type') === FilterType.Select) {
let foundFilterOption = get(filter, 'options').find((option) =>
typeof option === 'string'
? option === appliedFilterValue
: get(option, 'value') === appliedFilterValue
);
if (foundFilterOption) {
return typeof foundFilterOption === 'string'
? foundFilterOption
: get(foundFilterOption, 'label');
}
}
if (get(filter, 'type') === FilterType.DateSelector) {
if (get(filter, 'key') === get(appliedFilter, 'key')) {
return getFilterLabelForValue(get(appliedFilter, 'value'));