@faasjs/deep_merge 2.3.1 → 2.4.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/dist/index.js CHANGED
@@ -9,16 +9,13 @@ function deepMerge(...sources) {
9
9
  let acc = /* @__PURE__ */ Object.create(null);
10
10
  for (const source of sources)
11
11
  if (Array.isArray(source)) {
12
- if (!Array.isArray(acc))
13
- acc = [];
12
+ if (!Array.isArray(acc)) acc = [];
14
13
  acc = [...new Set(source.concat(...acc))];
15
14
  } else if (shouldMerge(source))
16
15
  for (const [key, value] of Object.entries(source)) {
17
16
  let val;
18
- if (shouldMerge(value))
19
- val = deepMerge(acc[key], value);
20
- else
21
- val = value;
17
+ if (shouldMerge(value)) val = deepMerge(acc[key], value);
18
+ else val = value;
22
19
  acc = {
23
20
  ...acc,
24
21
  [key]: val
package/dist/index.mjs CHANGED
@@ -7,16 +7,13 @@ function deepMerge(...sources) {
7
7
  let acc = /* @__PURE__ */ Object.create(null);
8
8
  for (const source of sources)
9
9
  if (Array.isArray(source)) {
10
- if (!Array.isArray(acc))
11
- acc = [];
10
+ if (!Array.isArray(acc)) acc = [];
12
11
  acc = [...new Set(source.concat(...acc))];
13
12
  } else if (shouldMerge(source))
14
13
  for (const [key, value] of Object.entries(source)) {
15
14
  let val;
16
- if (shouldMerge(value))
17
- val = deepMerge(acc[key], value);
18
- else
19
- val = value;
15
+ if (shouldMerge(value)) val = deepMerge(acc[key], value);
16
+ else val = value;
20
17
  acc = {
21
18
  ...acc,
22
19
  [key]: val
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/deep_merge",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",