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

Function equals

ark/schema/node.ts:1231–1245  ·  view source on GitHub ↗
(r: unknown)

Source from the content-addressed store, hash-verified

1229 }
1230
1231 equals(r: unknown): boolean {
1232 const rNode: BaseNode =
1233 isNode(r) && isInstanceOf(r, BaseNode) ? r : this.$.parseDef(r)
1234 // a hash includes its node's kind, so nodes of different kinds aren't hashed
1235 if (
1236 this === rNode ||
1237 (this.kind === rNode.kind && innerHashesMatch(this, rNode))
1238 )
1239 return true
1240 return (
1241 (this.hasAlias || rNode.hasAlias) &&
1242 isResolutionFinal() &&
1243 isMutuallySimulated(this, rNode)
1244 )
1245 }
1246
1247 ifEquals(r: unknown): BaseNode | undefined {
1248 return this.equals(r) ? this : undefined

Callers

nothing calls this directly

Calls 5

isNodeFunction · 0.90
isInstanceOfFunction · 0.90
isResolutionFinalFunction · 0.90
innerHashesMatchFunction · 0.85
isMutuallySimulatedFunction · 0.85

Tested by

no test coverage detected