monocle-ts
mutative
Our great sponsors
monocle-ts | mutative | |
---|---|---|
7 | 14 | |
1,016 | 1,454 | |
- | - | |
0.0 | 8.8 | |
over 1 year ago | 10 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
monocle-ts
-
Deep Cloning Objects in JavaScript, the Modern Way
Instead of the "deep path properties" syntax, you might want to take the opportunity to learn about functional lenses with monocle-ts
https://gcanti.github.io/monocle-ts/
-
I may have a crush on the TypeScript compiler, because of stuff like this
You may be interested also in checking out the implementation of Lens in monocle-ts, one of the libraries in the fp-ts ecosystem
-
Haskell Lens Tutorial by Exercises
For anyone - anyone who's faffed around with JavaScript's spread syntax when working with nested immutable data, anyway - struggling to understand the general concept or utility of lenses, I'd encourage looking into monocle-ts. The motivation [0] that kicks off the README instantly made me a believer, and TypeScript's idiosyncratic type system makes using the library remarkably natural; it fits right in without needing to deal with anything analogous to Template Haskell.
[0] https://github.com/gcanti/monocle-ts#motivation
-
Is there a cleaner way to immutably update a deeply nested attribute? (I feel like this is not very clean)
You could have a look at the monocle-ts library. It was designed to deal with this kind of problem.
-
Simple Immutable Data w/ Spectacles π
spectacles-ts integrates seamlessly with the fp-ts ecosystem (it's built on top of the excellent monocle-ts library)
-
Why is it so difficult to modify a deeply nested state in React?
lenses help with this quite a bit, check out monocle-ts
-
You could have invented lenses!
You notice that Getters are composable as they are just pure functions, but the fact that setters are mutating values is not that nice. Tho, at this point we have invented quasi mutable lenses and If you really want you might invent actual purely functional lenses as well, but thatβs for another day. Meanwhile you can take a look at an actual typescript lesses library from @gcanti / monocle-ts.
mutative
-
Mutative 1.0 β A New Era in Efficient Immutable Updates
The readme explains how Mutative achieves better performance over Immer: https://github.com/unadlib/mutative#readme
-
Immer VS mutative - a user suggested alternative
2 projects | 25 Jan 2024
Efficient immutable updates, 2-6x faster than naive handcrafted reducer, and more than 10x faster than Immer.
-
How to build high-performance front-end applications based on multi-processing
High Performance Based on Mutative: Mutative is faster than the naive handcrafted reducer and 10x faster than Immer. Updates to immutable data based on Mutative also maintain good performance. The patches obtained from the shared state update are used for state synchronization.
- Mutative β A 10x Faster Alternative to Immer
-
Deep Cloning Objects in JavaScript, the Modern Way
for those recommending Immer, check out Mutative or Limu instead (much faster)
https://github.com/unadlib/mutative
https://github.com/tnfe/limu
-
Limu, the fastest immutable data JavaScript lib was borned
![image](https://github.com/unadlib/mutative/assets/7334950/2520b8e9-...)
At the same time, the number of single test cases has increased to 500+, with a coverage rate of '95+' (the results can be viewed by executing NPM run tests in the root directory)
- Mutative: production-ready version coming soon, it provides the fastest immutable data updates.
- Mutative: Efficient immutable JavaScript updates, 10x faster than Immer
- GitHub - unadlib/mutative: Efficient immutable updates, 10x faster than Immer by default, even faster than naive handcrafted reducer.
What are some alternatives?
optics-ts - Type-safe, ergonomic, polymorphic optics for TypeScript
limu - High performance immutable lib alternative to immer with the same api, based on shallow copy on read and mark modified on write mechanism.
zustand - π» Bear necessities for state management in React
nstate - A simple but powerful react state management library with low mind burden
spectacles-ts - Practical Optics β’ Unfancy monocle-ts
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
immutability-helper - mutate a copy of data without changing the original source
cow-list - Copy-On-Write iterable list
fp-ts-contrib - A community driven utility package for fp-ts
riux - π¦ Fully typed and immutable store made on top of Immer with mutation, action, subscription and validation!
fp-ts - Functional programming in TypeScript
data-transport - A simple and responsible universal transport