избыточной сложностью
тяжеловесностью под капотом
filteredArray() {
return this.array
.filter((el) => {
return (!this.search.length ? true : (el?.name?.toLowerCase().includes(this.search) ||
el?.surname?.toLowerCase().includes(this.search))) &&
(this.salary === null ? true : el.salary === this.salary) &&
(this.quality === null ? true : el.quality === this.quality) &&
(this.rating === null ? true : el.rating === this.rating && el.mode !== MODES.HIGH) &&
(this.body === null ? true : (this.body === Bodys.CHECKED ? el.workers.some(({ checked }, index) =>
index <= el.workersIds.length - 1 ? !checked : false
)
: el.workers.every(({ checked }, index) =>
index <= el.workersIds.length - 1 ? checked : true
)) )
}).sort((a, b) => {
if (a?.name?.toLowerCase() > b?.name?.toLowerCase()) {
return isDesc ? -1 : 1;
}
if (a?.name?.toLowerCase() < b?.name?.toLowerCase()) {
return isDesc ? 1 : -1;
}
return 0;
});
},