(val)
| 149 | let nextIdentityId = 0; |
| 150 | |
| 151 | const stringifyToJSON = (val) => { |
| 152 | const seen = new WeakSet(); |
| 153 | |
| 154 | return JSON.stringify(val, (key, value) => { |
| 155 | if (typeof value === 'object' && value !== null) { |
| 156 | if (seen.has(value)) { |
| 157 | return undefined; |
| 158 | } |
| 159 | |
| 160 | seen.add(value); |
| 161 | |
| 162 | // DOM nodes carry framework metadata as enumerable own properties |
| 163 | // (e.g., Vue 3 attaches `_vnode` to the mount root). Recursing into them |
| 164 | // can reach getters that throw - see GH #11220 - and produces noise that |
| 165 | // is irrelevant to settings equality. Replace each Node with an identity |
| 166 | // token so reference equality is still detected. |
| 167 | if (typeof Node !== 'undefined' && value instanceof Node) { |
| 168 | let id = identityMap.get(value); |
| 169 | |
| 170 | if (id === undefined) { |
| 171 | nextIdentityId += 1; |
| 172 | id = `__hot_node_${nextIdentityId}__`; |
| 173 | identityMap.set(value, id); |
| 174 | } |
| 175 | |
| 176 | return id; |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | return value; |
| 181 | }); |
| 182 | }; |
| 183 | |
| 184 | if (typeof objectA === 'function' && typeof objectB === 'function') { |
| 185 | return objectA.toString() === objectB.toString(); |
no test coverage detected
searching dependent graphs…