You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
## [1.0 Release Candidate](https://github.com/Zenika/immutadot/releases) is out 🎉
24
-
25
-
We are still writing the documentation, you can already find out about the [updated API](https://zenika.github.io/immutadot/immutadot/1.0) and our new package [immutadot-lodash](https://zenika.github.io/immutadot/immutadot-lodash/1.0).
26
-
27
-
If you would like to try out 1.0 before its official release, install it with :
28
-
29
-
```shell
30
-
yarn add immutadot@next
31
-
```
32
-
33
-
or
34
-
35
-
36
-
```shell
37
-
npm install immutadot@next
38
-
```
23
+
## [1.0](https://github.com/Zenika/immutadot/releases) is out 🎉
39
24
40
25
If you were using a previous version of immutad●t, check out the [migrating guide](docs/MIGRATING_TO_1_0.md).
41
26
42
-
## Immutability
43
-
44
-
In the last few years one of our biggest challenge has been to find an efficient way to detect changes in our data to determine when to re-render our interfaces.
45
-
46
-
An immutable object is an object that cannot be changed once created. It brings several benefits<sup>[1](#notes)</sup>:
47
-
48
-
- Data changes detection made simple (Shallow comparison)
49
-
- Memoization
50
-
- Improve rendering performances
51
-
- Explicit data changes
52
-
- Avoid side effects
53
-
54
-
## Our approach
55
-
56
-
### Concise
57
-
58
-
[ES2015+](https://mdn.io/JavaScript/Reference) new features are great to deal with arrays and objects. As data structures expand, the code you write to make data immutable gets bigger and less readable. immutad●t uses the dot notation to address this issue.
59
-
60
-
### Interoperability
61
-
62
-
immutad●t uses plain JavaScript objects so you can access your data using standard ways. Moreover, it lets you freely enjoy your favorite libraries.
63
-
64
-
### Exhaustive and yet extensible
65
-
66
-
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://mdn.io/JavaScript/Reference). You can also find a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the [`convert`](https://zenika.github.io/immutadot/immutadot/1.0/core.html#.convert) feature.
67
-
68
-
### Learning curve
69
-
70
-
If you are already familiar with [ES2015+](https://mdn.io/JavaScript/Reference) and [lodash](https://lodash.com/) then you should be able to use immutad●t quickly.
71
-
72
27
## Installation
73
28
74
29
immutad●t is available on [npm repository](https://www.npmjs.com/package/immutadot).
@@ -103,90 +58,43 @@ const { set } = require('immutadot')
103
58
104
59
### Example
105
60
106
-
Object used in the following example:
61
+
Quickly set nested properties using [set()](https://zenika.github.io/immutadot/immutadot/1.0/core.html#.set)
107
62
108
63
```js
64
+
import { set } from'immutadot'
65
+
109
66
constanimals= {
110
-
weasels: [
111
-
{
112
-
vernacularName:'badger',
113
-
scientificName:'Meles meles'
67
+
weasels: {
68
+
lutraLutra: {
69
+
commonNames: ['eurasian otter'],
114
70
},
115
-
{
116
-
vernacularName:'otter',
117
-
}
118
-
]
71
+
},
119
72
}
120
-
```
121
-
122
-
Let's add the otter's scientific name without mutating the original object structure.
Learn more about what immutad●t can do in the [Getting started](https://github.com/Zenika/immutadot/blob/master/docs/GETTING_STARTED.md).
144
78
145
79
Feel free to [try immutad●t on runkit](https://npm.runkit.com/immutadot).
146
80
147
-
## Path notation
148
-
149
-
immutad●t brings a few improvements to the classic dot notation:
150
-
151
-
### Slice notation
152
-
153
-
The slice notation lets you iterate over arrays to apply operations without having to map arrays at each level of imbrication.
154
-
155
-
We forgot to capitalize vernacular names in the [input](#Example).
156
-
157
-
using ES2015+:
81
+
## Documentation
158
82
159
-
```js
160
-
import { capitalize } from'lodash'
161
-
constnewAnimals= {
162
-
...animals,
163
-
weasels:animals.weasels.map(weasel=> {
164
-
return {
165
-
...weasel,
166
-
vernacularName:capitalize(weasel.vernacularName),
167
-
}
168
-
}),
169
-
}
170
-
```
83
+
### Getting started
171
84
172
-
using immutad●t-lodash:
85
+
A fast overview of immutad●t's features is available in the [Getting started](https://github.com/Zenika/immutadot/blob/master/docs/GETTING_STARTED.md) guide.
If you were using a version of immutad●t previous to 1.0, check out the [migrating guide](docs/MIGRATING_TO_1_0.md).
190
98
191
99
## Performances
192
100
@@ -218,19 +126,35 @@ Update large todos list (100000 items):
218
126
immutad●t 1.0.0: ~23ops/s (44.15ms/op) on 500ops
219
127
```
220
128
221
-
## Documentation
129
+
## Immutability
222
130
223
-
### Getting started
131
+
In the last few years one of our biggest challenge has been to find an efficient way to detect changes in our data to determine when to re-render our interfaces.
224
132
225
-
A fast overview of immutad●t's features is available in the [Getting started](https://github.com/Zenika/immutadot/blob/master/docs/GETTING_STARTED.md) guide.
133
+
An immutable object is an object that cannot be changed once created. It brings several benefits<sup>[1](#notes)</sup>:
226
134
227
-
### API
135
+
- Data changes detection made simple (Shallow comparison)
136
+
- Memoization
137
+
- Improve rendering performances
138
+
- Explicit data changes
139
+
- Avoid side effects
228
140
229
-
The detailed API documentations of the different packages are available here:
Looking for older versions API documentation? Links are available [here](https://github.com/Zenika/immutadot/blob/master/docs/README.md).
143
+
### Concise
144
+
145
+
[ES2015+](https://mdn.io/JavaScript/Reference) new features are great to deal with arrays and objects. As data structures expand, the code you write to make data immutable gets bigger and less readable. immutad●t uses the dot notation to address this issue.
146
+
147
+
### Interoperability
148
+
149
+
immutad●t uses plain JavaScript objects so you can access your data using standard ways. Moreover, it lets you freely enjoy your favorite libraries.
150
+
151
+
### Exhaustive and yet extensible
152
+
153
+
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://mdn.io/JavaScript/Reference). You can also find a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the [`convert`](https://zenika.github.io/immutadot/immutadot/1.0/core.html#.convert) feature.
154
+
155
+
### Learning curve
156
+
157
+
If you are already familiar with [ES2015+](https://mdn.io/JavaScript/Reference) and [lodash](https://lodash.com/) then you should be able to use immutad●t quickly.
0 commit comments