Is using libraries as lodash really safe ? I have some mutaging problem in development, I prefer solving it with javascript native work around ( spread operator), since lodash is quite heavy and hide the complexity behind mutation. But native solution looks like it is not powerfull enough to deal with deeply nested object with a objects and arrays. Is there someone here who could have a suggestion ? ( JSON.parse(JSON.stringify(object)) works but it's not optimized for memory and my typeScript refuse the use of structuredClone(). Thx for all your videos, just to let you know, I built my rest API on your fastify videos ;-)
Yeah of course using lodash is safe. Why would it not be? JSON.parse(JSON.stringify(object)) should be avoided because it doesn't copy some properties such as symbol, functions or undefined.
@@TomDoesTech MyObject = {status : true, AllUsers: [{name:"jhone", credentials: ["home", "editUser"] } , {name:"Tom", credentials: ["home", "library"] } ] } . How can we change MyObject.AllUsers[0].credentials[1] from "editUser" to "editAdmin" (all values are faked, is just to illustrate the difficulty to use newObject = {...MyObject, AllUsers : {...AllUser , ...AndSoOn I'm quite stuck to that point to be honest. I use React-Query, so nested Object are legions and mutaging through the app really tricky
Need more microservices and more complex stuff 🔥
Is using libraries as lodash really safe ? I have some mutaging problem in development, I prefer solving it with javascript native work around ( spread operator), since lodash is quite heavy and hide the complexity behind mutation. But native solution looks like it is not powerfull enough to deal with deeply nested object with a objects and arrays. Is there someone here who could have a suggestion ? ( JSON.parse(JSON.stringify(object)) works but it's not optimized for memory and my typeScript refuse the use of structuredClone().
Thx for all your videos, just to let you know, I built my rest API on your fastify videos ;-)
Yeah of course using lodash is safe. Why would it not be?
JSON.parse(JSON.stringify(object)) should be avoided because it doesn't copy some properties such as symbol, functions or undefined.
2:10 I thought he said "and this is where we can run into some dogshit" 🤣😂 had to watch it back to realise he said "gotchas"
haha
Thank you for the thorough explanation!
Whoa
Just use JSON object methods like parse( ) and stringify( ) or use newly added structuredClone( ) function
Really like your way of explaining things. Very thorough. Keep it coming and thanks!
I actually like revisiting the fundamentals
really great explanation, thanks Tom
Wow! Amazing with lodash!
This stuff gets really nasty when you’re dealing with objects within objects and I’m yet to find an elegant solution. Anyone have any suggestions?
Do you have an example? Happy to take a look
@@TomDoesTech Easy to fix, but I wrote something like this recently `const myArray = new Array(10).fill(new Array(10).fill(0))`
const obj2 = JSON.parse( JSON.stringify( obj1 ) )
@@TomDoesTech MyObject = {status : true, AllUsers: [{name:"jhone", credentials: ["home", "editUser"] } , {name:"Tom", credentials: ["home", "library"] } ] } . How can we change MyObject.AllUsers[0].credentials[1] from "editUser" to "editAdmin" (all values are faked, is just to illustrate the difficulty to use newObject = {...MyObject, AllUsers : {...AllUser , ...AndSoOn I'm quite stuck to that point to be honest. I use React-Query, so nested Object are legions and mutaging through the app really tricky
Curious to what techonology did you use to generate such beatiful slides
CodeHike