Repository navigation
Expand file tree
/
Copy pathpack-snapshot.json
More file actions
111 lines (111 loc) · 4.4 KB
/
Copy pathpack-snapshot.json
File metadata and controls
111 lines (111 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
"manifest": {
"name": "react-fast-compare",
"main": "index.js",
"types": "index.d.ts",
"typings": "index.d.ts",
"sideEffects": false,
"files": [
"index.js",
"index.d.ts"
]
},
"files": [
"LICENSE",
"README.md",
"index.d.ts",
"index.js",
"package.json"
],
"resolutions": {
"node10": "types=index.d.ts js=index.js",
"node16-cjs": "types=index.d.ts js=index.js",
"node16-esm": "types=index.d.ts js=index.js",
"bundler": "types=index.d.ts js=index.js"
},
"types": [
"declare function isEqual<A = any, B = any>(a: A, b: B): boolean;",
"export = isEqual;",
""
],
"code": [
"var hasElementType = typeof Element !== \"undefined\";",
"",
"var hasMap = typeof Map === \"function\";",
"",
"var hasSet = typeof Set === \"function\";",
"",
"var hasArrayBuffer = typeof ArrayBuffer === \"function\" && !!ArrayBuffer.isView;",
"",
"var hasDataView = typeof DataView === \"function\";",
"",
"function equal(a, b) {",
" if (a === b) return true;",
" if (a && b && typeof a == \"object\" && typeof b == \"object\") {",
" if (a.constructor !== b.constructor) return false;",
" var length, i, keys;",
" if (Array.isArray(a)) {",
" length = a.length;",
" if (length != b.length) return false;",
" for (i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false;",
" return true;",
" }",
" var it;",
" if (hasMap && a instanceof Map && b instanceof Map) {",
" if (a.size !== b.size) return false;",
" it = a.entries();",
" while (!(i = it.next()).done) if (!b.has(i.value[0])) return false;",
" it = a.entries();",
" while (!(i = it.next()).done) if (!equal(i.value[1], b.get(i.value[0]))) return false;",
" return true;",
" }",
" if (hasSet && a instanceof Set && b instanceof Set) {",
" if (a.size !== b.size) return false;",
" it = a.entries();",
" while (!(i = it.next()).done) if (!b.has(i.value[0])) return false;",
" return true;",
" }",
" if (hasDataView && a instanceof DataView && b instanceof DataView) {",
" length = a.byteLength;",
" if (length !== b.byteLength) return false;",
" for (i = length; i-- !== 0; ) if (a.getUint8(i) !== b.getUint8(i)) return false;",
" return true;",
" }",
" if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {",
" length = a.length;",
" if (length != b.length) return false;",
" for (i = length; i-- !== 0; ) if (a[i] !== b[i]) return false;",
" return true;",
" }",
" if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;",
" if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === \"function\" && typeof b.valueOf === \"function\") return a.valueOf() === b.valueOf();",
" if (a.toString !== Object.prototype.toString && typeof a.toString === \"function\" && typeof b.toString === \"function\") return a.toString() === b.toString();",
" keys = Object.keys(a);",
" length = keys.length;",
" if (length !== Object.keys(b).length) return false;",
" for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;",
" if (hasElementType && a instanceof Element) return false;",
" for (i = length; i-- !== 0; ) {",
" if ((keys[i] === \"_owner\" || keys[i] === \"__v\" || keys[i] === \"__o\") && a.$$typeof) {",
" continue;",
" }",
" if (!equal(a[keys[i]], b[keys[i]])) return false;",
" }",
" return true;",
" }",
" return a !== a && b !== b;",
"}",
"",
"module.exports = function isEqual(a, b) {",
" try {",
" return equal(a, b);",
" } catch (error) {",
" if ((error.message || \"\").match(/stack|recursion/i)) {",
" console.warn(\"react-fast-compare cannot handle circular refs\");",
" return false;",
" }",
" throw error;",
" }",
"};"
]
}