objwalk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install objwalk
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import { each, extract, map, merge, pick, set } from 'objwalk'
|
|
16
|
+
import { each, equally, extract, map, merge, pick, set } from 'objwalk'
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## pick
|
|
@@ -94,6 +94,21 @@ set(data, 'items[0].title', 'First')
|
|
|
94
94
|
|
|
95
95
|
`set` mutates the object passed to it and returns the same object.
|
|
96
96
|
|
|
97
|
+
## equally
|
|
98
|
+
|
|
99
|
+
Deeply compare two values for structural equality.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
equally({ a: { b: [1, 2] } }, { a: { b: [1, 2] } })
|
|
103
|
+
// true
|
|
104
|
+
|
|
105
|
+
equally({ a: 1 }, { a: 1, b: 2 })
|
|
106
|
+
// false
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`equally` treats `NaN` as equal to `NaN`, compares `Date` by timestamp and `RegExp` by
|
|
110
|
+
source and flags, and follows circular references without looping.
|
|
111
|
+
|
|
97
112
|
## merge
|
|
98
113
|
|
|
99
114
|
Deeply merge plain objects into a target object.
|
|
@@ -218,4 +233,5 @@ extract(data, mapping)
|
|
|
218
233
|
each(data, callback)
|
|
219
234
|
map(data, callback)
|
|
220
235
|
merge(target, ...sources)
|
|
236
|
+
equally(a, b)
|
|
221
237
|
```
|