Advertisement
pcriativa

Circular items computed

Nov 30th, 2020
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. formattedItems: {
  2.             get() {
  3.                 let items = [];
  4.  
  5.                 this.items.map(mapItem => mapItem.categories = this.optionsCategories);
  6.                 this.items.forEach((item, index, array) => {
  7.                     array.forEach(el => {
  8.                         if(el.id === item.id && el.category !== item.category) {
  9.                             el.categories = el.categories.filter(category => category !== item.category);
  10.                         }
  11.                     });
  12.  
  13.                     items = [...array];
  14.                 });
  15.  
  16.                 return items;
  17.             }
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement