1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.BaggageImpl = void 0;
|
19 | class BaggageImpl {
|
20 | constructor(entries) {
|
21 | this._entries = entries ? new Map(entries) : new Map();
|
22 | }
|
23 | getEntry(key) {
|
24 | const entry = this._entries.get(key);
|
25 | if (!entry) {
|
26 | return undefined;
|
27 | }
|
28 | return Object.assign({}, entry);
|
29 | }
|
30 | getAllEntries() {
|
31 | return Array.from(this._entries.entries()).map(([k, v]) => [k, v]);
|
32 | }
|
33 | setEntry(key, entry) {
|
34 | const newBaggage = new BaggageImpl(this._entries);
|
35 | newBaggage._entries.set(key, entry);
|
36 | return newBaggage;
|
37 | }
|
38 | removeEntry(key) {
|
39 | const newBaggage = new BaggageImpl(this._entries);
|
40 | newBaggage._entries.delete(key);
|
41 | return newBaggage;
|
42 | }
|
43 | removeEntries(...keys) {
|
44 | const newBaggage = new BaggageImpl(this._entries);
|
45 | for (const key of keys) {
|
46 | newBaggage._entries.delete(key);
|
47 | }
|
48 | return newBaggage;
|
49 | }
|
50 | clear() {
|
51 | return new BaggageImpl();
|
52 | }
|
53 | }
|
54 | exports.BaggageImpl = BaggageImpl;
|
55 |
|
\ | No newline at end of file |