immerjs/immer — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small JavaScript library called Immer that helps app developers update state without accidentally changing the original object. I want the developer experience to feel like writing normal changes to a draft, like setting fields, pushing into arrays, deleting values, or changing nested data, and then the library gives back a new state while the old one stays safe.

It should work well for reducer style code in React or Redux, handle plain objects and arrays, and keep the parts that did not change shared when possible so it is not wasteful. Add clear tests that show nested updates, array changes, no changes returning the original value, and original data not being mutated.

Please include a simple README with examples and a small documentation site or docs folder explaining the idea in beginner friendly language. Set up the package so it can be built, tested, and published cleanly. Look up current docs online if you need to.

Want more depth? Deep Reverse