MCPcopy
hub / github.com/sindresorhus/ow / hasAnyKeys

Method hasAnyKeys

source/predicates/map.ts:70–75  ·  view source on GitHub ↗

Test a Map to include any of the provided keys. The keys are tested by identity, not structure. @param keys - The keys that could be a key in the Map.

(...keys: readonly T1[])

Source from the content-addressed store, hash-verified

68 @param keys - The keys that could be a key in the Map.
69 */
70 hasAnyKeys(...keys: readonly T1[]): this {
71 return this.addValidator({
72 message: (_, label) => `Expected ${label} to have any key of \`${JSON.stringify(keys)}\``,
73 validator: map => keys.some(key => map.has(key)),
74 });
75 }
76
77 /**
78 Test a Map to include all the provided values. The values are tested by identity, not structure.

Callers 3

map.tsFile · 0.45
object.tsFile · 0.45
weak-map.tsFile · 0.45

Calls 2

addValidatorMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected