Closed yayza closed 2 years ago
Looks good, although at line 287 you've got brackets around updatedServer. Can you explain what's happening there? Is that loading it into a pointer for the Object stuff underneath to then do direct modifications to it?
It's just ES6 syntactic sugar. The brackets are unpacking/destructuring the the filter method's returning array (in this case just a single element) into the variable updatedServer
. It's still a copy and still needs to get pushed back into the remaining stack of servers like it was done before. I was thinking of mutating the original array, but I don't know if that will introduce bad side-effects.
I updated it again for better readability (and to skip a value update if it never changed).
Ah, so it's a ES6 thing. I'm not familiar with ES6 and well, I just know enough basics to make things work. 😅
Looks good to me, I'll merge it in. Thanks for the contribution!
Cleaned up apiUpdateServerInList function a little by changing the conditionals to a forEach loop.