$ account unadlib
Mutative is a high-performance JavaScript/TypeScript library for immutable state updates using a mutable syntax, similar to Immer but with significantly better performance (claimed 2-6x faster than naive reducers, >10x faster than Immer). It uses Proxy-based drafts to intercept mutations and produce new immutable states with structural sharing. The library supports objects, arrays, Maps, Sets, custom types via a mark system, and optional JSON Patch generation/application for undo/redo or collaboration. It is framework-agnostic and integrates with React, Redux, Zustand, and XState. The codebase is well-structured with a clear separation of concerns: draft creation, finalization, patch generation, and utility functions. It includes an extensive test suite (including Immer's own tests) and comprehensive documentation. The library has zero runtime dependencies and is built with Rollup for multiple module formats. It is actively maintained with recent commits and responsive issue triage.