News for hackers. Stuff that matters.
Re:Deep Cloning Objects in JavaScript, the Modern Way by LegionMammal978 on Thursday December 21, 2023 @11:34PM (#38730965)
Another issue is the opposite situation, where the library reads from the object multiple times, expecting the value to be stable, but the caller might change the value in between, either from the properties using getters or from the library being async. The library has to make a full deep copy to ensure that it's completely stable regardless of the caller's actions. Just freezing the input object would be confusing to the caller and still vulnerable to property getters.
Re:Deep Cloning Objects in JavaScript, the Modern Way by WendyTheWillow on Friday December 22, 2023 @01:32AM (#38731549)
That’s even worse! I would try to avoid a library with a function that fragile.