MCPcopy Create free account
hub / github.com/arktypeio/arktype / isSameConfig

Function isSameConfig

ark/schema/shared/configured.ts:37–56  ·  view source on GitHub ↗
(l: unknown, r: unknown)

Source from the content-addressed store, hash-verified

35 * unless it's native, like a bound one, whose source is the same for any
36 */
37export 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}

Callers 2

configureSchemaFunction · 0.90
configureFunction · 0.90

Calls 2

callMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected