@faasjs/deep_merge 0.0.2-beta.362 → 0.0.2-beta.366
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 +20 -12
- package/dist/index.d.ts +11 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# @faasjs/deep_merge
|
|
2
2
|
|
|
3
|
-
合并对象
|
|
4
|
-
|
|
5
3
|
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/deep_merge/LICENSE)
|
|
6
4
|
[](https://www.npmjs.com/package/@faasjs/deep_merge)
|
|
7
5
|
[](https://www.npmjs.com/package/@faasjs/deep_merge)
|
|
8
6
|
|
|
7
|
+
A helper function to deep merge objects and array.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
npm install @faasjs/deep_merge
|
|
12
|
+
|
|
9
13
|
## Modules
|
|
10
14
|
|
|
11
15
|
### Functions
|
|
12
16
|
|
|
13
|
-
- [deepMerge](
|
|
17
|
+
- [deepMerge](#deepmerge)
|
|
14
18
|
|
|
15
19
|
## Functions
|
|
16
20
|
|
|
@@ -18,19 +22,23 @@
|
|
|
18
22
|
|
|
19
23
|
▸ **deepMerge**(...`sources`): `any`
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
Deep merge two objects or arrays.
|
|
26
|
+
|
|
27
|
+
Features:
|
|
28
|
+
* All objects will be cloned before merging.
|
|
29
|
+
* Merging order is from right to left.
|
|
30
|
+
* If an array include same objects, it will be unique to one.
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* 若有数组形式的属性,数组里的内容将被去重合并
|
|
32
|
+
```ts
|
|
33
|
+
deepMerge({ a: 1 }, { a: 2 }) // { a: 2 }
|
|
34
|
+
deepMerge([1, 2], [2, 3]) // [1, 2, 3]
|
|
35
|
+
```
|
|
28
36
|
|
|
29
37
|
#### Parameters
|
|
30
38
|
|
|
31
|
-
| Name | Type |
|
|
32
|
-
| :------ | :------ |
|
|
33
|
-
| `...sources` | `any`[] |
|
|
39
|
+
| Name | Type |
|
|
40
|
+
| :------ | :------ |
|
|
41
|
+
| `...sources` | `any`[] |
|
|
34
42
|
|
|
35
43
|
#### Returns
|
|
36
44
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* *
|
|
6
|
-
* *
|
|
7
|
-
* *
|
|
8
|
-
*
|
|
2
|
+
* Deep merge two objects or arrays.
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* * All objects will be cloned before merging.
|
|
6
|
+
* * Merging order is from right to left.
|
|
7
|
+
* * If an array include same objects, it will be unique to one.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* deepMerge({ a: 1 }, { a: 2 }) // { a: 2 }
|
|
11
|
+
* deepMerge([1, 2], [2, 3]) // [1, 2, 3]
|
|
12
|
+
* ```
|
|
9
13
|
*/
|
|
10
14
|
declare function deepMerge(...sources: any[]): any;
|
|
11
15
|
|