Advertisement
KoctrX

Untitled

Oct 27th, 2022
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. function deleteByUUID(data, uuid) {
  2. if(Array.isArray(data)) {
  3. return data.map(item => {
  4. if(item.uuid == uuid) return false;
  5. if(item.data) {
  6. for(const key in item.data) {
  7. item.data[key] = deleteByUUID(item.data[key], uuid);
  8. }
  9. }
  10.  
  11. return item;
  12. }).filter(q => q);
  13. } else {
  14. return data;
  15. }
  16.  
  17. return data;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement