Hacker News new | ask | show | jobs
by kretaceous 425 days ago
Not the point of the article but just two cents about the JS part:

- While not part of the ECMAScript spec, there is a Web API called structuredClone for deep copying objects. It's implemented in major runtimes like Node (17+), Bun and Deno. https://developer.mozilla.org/en-US/docs/Web/API/Window/stru...

- I've found a total of one use case for Object.freeze until today. Since exported modules are live bindings and are mutable, exporting a global object which is not intended to change during the runtime (e.g. an application wide config) is a bad idea. Exporting the object after wrapping it in Object.freeze can help avoid unnecessary mutations to it.