MCPcopy
hub / github.com/vitest-dev/vitest / hasAsymmetric

Function hasAsymmetric

packages/expect/src/jest-utils.ts:52–70  ·  view source on GitHub ↗
(obj: any, seen: Set<any> = new Set())

Source from the content-addressed store, hash-verified

50}
51
52export function hasAsymmetric(obj: any, seen: Set<any> = new Set()): boolean {
53 if (seen.has(obj)) {
54 return false
55 }
56 seen.add(obj)
57 if (isAsymmetric(obj)) {
58 return true
59 }
60 if (Array.isArray(obj)) {
61 return obj.some(i => hasAsymmetric(i, seen))
62 }
63 if (obj instanceof Set) {
64 return Array.from(obj).some(i => hasAsymmetric(i, seen))
65 }
66 if (isObject(obj)) {
67 return Object.values(obj).some(v => hasAsymmetric(v, seen))
68 }
69 return false
70}
71
72function asymmetricMatch(a: any, b: any, customTesters: Array<Tester>) {
73 const asymmetricA = isAsymmetric(a)

Callers

nothing calls this directly

Calls 4

isObjectFunction · 0.90
isAsymmetricFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected