(l: unknown, r: unknown)
| 35 | * unless it's native, like a bound one, whose source is the same for any |
| 36 | */ |
| 37 | export const isSameConfig = (l: unknown, r: unknown): boolean => { |
| 38 | if (l === r) return true |
| 39 | if (typeof l === "function" && typeof r === "function") { |
| 40 | const source = Function.prototype.toString.call(l) |
| 41 | return ( |
| 42 | source === Function.prototype.toString.call(r) && |
| 43 | !/\[native code]\s*}$/.test(source) |
| 44 | ) |
| 45 | } |
| 46 | if (typeof l !== "object" || typeof r !== "object" || !l || !r) return false |
| 47 | const entries = Object.entries(l) |
| 48 | return ( |
| 49 | entries.length === Object.keys(r).length && |
| 50 | entries.every( |
| 51 | ([k, v]) => |
| 52 | Object.prototype.hasOwnProperty.call(r, k) && |
| 53 | isSameConfig(v, (r as Record<string, unknown>)[k]) |
| 54 | ) |
| 55 | ) |
| 56 | } |
no test coverage detected