MCPcopy
hub / github.com/jestjs/jest / hasProperty

Function hasProperty

packages/expect/src/asymmetricMatchers.ts:44–57  ·  view source on GitHub ↗
(
  obj: object | null,
  property: string | symbol,
)

Source from the content-addressed store, hash-verified

42});
43
44export function hasProperty(
45 obj: object | null,
46 property: string | symbol,
47): boolean {
48 if (!obj) {
49 return false;
50 }
51
52 if (Object.prototype.hasOwnProperty.call(obj, property)) {
53 return true;
54 }
55
56 return hasProperty(Object.getPrototypeOf(obj), property);
57}
58
59export abstract class AsymmetricMatcher<
60 T,

Callers 1

asymmetricMatchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected