yummies 3.1.1 → 3.1.2
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/data.d.ts.map +1 -1
- package/data.js +24 -9
- package/package.json +1 -1
package/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,MAAO,OAAO,KAAK,OAAO,KAAG,OA8CvD,CAAC"}
|
package/data.js
CHANGED
|
@@ -7,20 +7,35 @@ export const isShallowEqual = (a, b) => {
|
|
|
7
7
|
b === null) {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
+
if (a.constructor !== b.constructor)
|
|
11
|
+
return false;
|
|
10
12
|
const isArrayA = Array.isArray(a);
|
|
11
|
-
|
|
12
|
-
if (isArrayA !== isArrayB)
|
|
13
|
+
if (isArrayA !== Array.isArray(b))
|
|
13
14
|
return false;
|
|
14
|
-
if (isArrayA
|
|
15
|
-
|
|
15
|
+
if (isArrayA) {
|
|
16
|
+
const arrA = a;
|
|
17
|
+
const arrB = b;
|
|
18
|
+
if (arrA.length !== arrB.length)
|
|
19
|
+
return false;
|
|
20
|
+
for (const [i, element] of arrA.entries()) {
|
|
21
|
+
if (element !== arrB[i])
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
16
25
|
}
|
|
26
|
+
if (a instanceof Date)
|
|
27
|
+
return a.getTime() === b.getTime();
|
|
28
|
+
if (a instanceof RegExp)
|
|
29
|
+
return a.toString() === b.toString();
|
|
17
30
|
const aKeys = Object.keys(a);
|
|
18
31
|
const bKeys = Object.keys(b);
|
|
19
32
|
if (aKeys.length !== bKeys.length)
|
|
20
33
|
return false;
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
const bObj = b;
|
|
35
|
+
for (const key of aKeys) {
|
|
36
|
+
if (!bObj.hasOwnProperty(key) || a[key] !== bObj[key]) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
26
41
|
};
|