1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.WeakMapPredicate = void 0;
|
4 | const has_items_1 = require("../utils/has-items");
|
5 | const predicate_1 = require("./predicate");
|
6 | class WeakMapPredicate extends predicate_1.Predicate {
|
7 | |
8 |
|
9 |
|
10 | constructor(options) {
|
11 | super('WeakMap', options);
|
12 | }
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 | hasKeys(...keys) {
|
19 | return this.addValidator({
|
20 | message: (_, label, missingKeys) => `Expected ${label} to have keys \`${JSON.stringify(missingKeys)}\``,
|
21 | validator: map => has_items_1.default(map, keys)
|
22 | });
|
23 | }
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 | hasAnyKeys(...keys) {
|
30 | return this.addValidator({
|
31 | message: (_, label) => `Expected ${label} to have any key of \`${JSON.stringify(keys)}\``,
|
32 | validator: map => keys.some(key => map.has(key))
|
33 | });
|
34 | }
|
35 | }
|
36 | exports.WeakMapPredicate = WeakMapPredicate;
|