@magic/deep 0.1.4 → 0.1.8

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 CHANGED
@@ -114,5 +114,19 @@ bump required node version to 14.2.0
114
114
  #### 0.1.4
115
115
  update dependencies
116
116
 
117
- #### 0.1.5 - unreleased
117
+ #### 0.1.5
118
+ * bump required node version to 14.15.4
119
+ * update dependencies
120
+
121
+ ##### 0.1.6
122
+ * merge now checks if o2.hasOwnProperty is a function before using it to check if we should overwrite keys of o1 or not.
123
+
124
+ ##### 0.1.7
125
+ update @magic/types to avoid circular dependency
126
+
127
+ ##### 0.1.8
128
+ * update dependencies
129
+ * use @magic/types for all type comparisons
130
+
131
+ ##### 0.1.9 - unreleased
118
132
  ...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/deep",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
4
4
  "author": "Wizards & Witches",
5
5
  "description": "manipulate nested objects and arrays",
6
6
  "homepage": "https://github.com/magic/deep",
@@ -16,7 +16,7 @@
16
16
  "calls": "calls"
17
17
  },
18
18
  "engine": {
19
- "node": ">=14.2.0"
19
+ "node": ">=14.15.4"
20
20
  },
21
21
  "engineStrict": true,
22
22
  "repository": {
@@ -30,12 +30,11 @@
30
30
  "src"
31
31
  ],
32
32
  "dependencies": {
33
- "@magic/types": "0.1.13"
33
+ "@magic/types": "0.1.16"
34
34
  },
35
35
  "devDependencies": {
36
- "@magic/cases": "0.0.3",
37
- "@magic/format": "0.0.15",
38
- "@magic/test": "0.1.54"
36
+ "@magic/format": "0.0.33",
37
+ "@magic/test": "0.1.77"
39
38
  },
40
39
  "contributors": [
41
40
  {
package/src/flatten.mjs CHANGED
@@ -1,4 +1,6 @@
1
- export const shallow = flat => (Array.isArray(flat) ? flatten(...flat) : flat)
1
+ import is from '@magic/types'
2
+
3
+ export const shallow = flat => (is.array(flat) ? flatten(...flat) : flat)
2
4
 
3
5
  export const concat = (flat, deep) => flat.concat(shallow(deep))
4
6
 
package/src/merge.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import is from '@magic/types'
2
2
 
3
3
  export const merge = (o1, o2) => {
4
- if (typeof o1 === 'undefined') {
4
+ if (is.undefined(o1)) {
5
5
  return o2
6
- } else if (typeof o2 === 'undefined') {
6
+ } else if (is.undefined(o2)) {
7
7
  return o1
8
8
  }
9
9
 
@@ -16,8 +16,9 @@ export const merge = (o1, o2) => {
16
16
  if (is.mergeable(o1) && is.mergeable(o2)) {
17
17
  const keys = Object.keys({ ...o1, ...o2 })
18
18
  const final = {}
19
+
19
20
  keys.forEach(key => {
20
- if (!o2.hasOwnProperty(key)) {
21
+ if (!is.function(o2.hasOwnProperty) || !o2.hasOwnProperty(key)) {
21
22
  final[key] = o1[key]
22
23
  } else {
23
24
  final[key] = merge(o1[key], o2[key])