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

Function compare

ark/aot/shadow.ts:956–974  ·  view source on GitHub ↗
(
	pair: Pair,
	// e.g. a validation's, printing its input only where they differ
	observation: string | (() => string),
	arktype: unknown,
	precompiled: unknown,
	reason?: string,
	counterparts = new Map<object, unknown>()
)

Source from the content-addressed store, hash-verified

954 : issues
955
956const compare = (
957 pair: Pair,
958 // e.g. a validation's, printing its input only where they differ
959 observation: string | (() => string),
960 arktype: unknown,
961 precompiled: unknown,
962 reason?: string,
963 counterparts = new Map<object, unknown>()
964): void => {
965 if (!isAlike(arktype, precompiled, { counterparts, originals: new Map() })) {
966 fail(
967 pair,
968 typeof observation === "string" ? observation : observation(),
969 printable(arktype),
970 printable(precompiled),
971 reason
972 )
973 }
974}
975
976const fail = (
977 pair: Pair,

Callers 4

shadowOfFunction · 0.70
memberOfFunction · 0.70
introspectFunction · 0.70
validateBothFunction · 0.70

Calls 4

printableFunction · 0.90
observationFunction · 0.85
isAlikeFunction · 0.70
failFunction · 0.70

Tested by

no test coverage detected