• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Bnaya / objectbuffer / 16263434879

14 Jul 2025 09:41AM UTC coverage: 89.747% (-0.3%) from 90.0%
16263434879

Pull #196

github

Bnaya
WIP
Pull Request #196: Typescript iteration - TS 5.8 and isolated declarations!

635 of 732 branches covered (86.75%)

Branch coverage included in aggregate %.

3 of 11 new or added lines in 4 files covered. (27.27%)

21 existing lines in 5 files now uncovered.

1247 of 1365 relevant lines covered (91.36%)

1658.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/internal/setWrapper.ts
1
import type { ExternalArgs, GlobalCarrier } from "./interfaces";
2
import {
3
  deleteObjectPropertyEntryByKey,
4
  objectSet,
5
  mapOrSetClear,
6
} from "./objectWrapperHelpers";
7

8

9
import { BaseProxyTrap } from "./BaseProxyTrap";
10
import {
11
  hashMapNodeLookup,
12
  hashMapSize,
13
  hashmapNodesPointerIterator,
14
  hashMapNodePointerToKey,
15
} from "./hashmap/hashmap";
16
import { entryToFinalJavaScriptValue } from "./entryToFinalJavaScriptValue";
17
import { object_pointerToHashMap_get } from "./generatedStructs";
18

19
export class SetWrapper<K extends string | number>
20
  extends BaseProxyTrap
21
  implements Set<K>
22
{
23
  union<U>(_other: ReadonlySetLike<U>): Set<K | U> {
NEW
24
    throw new Error("Method not implemented.");
×
25
  }
26
  intersection<U>(_other: ReadonlySetLike<U>): Set<K & U> {
NEW
27
    throw new Error("Method not implemented.");
×
28
  }
29
  difference<U>(_other: ReadonlySetLike<U>): Set<K> {
NEW
30
    throw new Error("Method not implemented.");
×
31
  }
32
  symmetricDifference<U>(_other: ReadonlySetLike<U>): Set<K | U> {
NEW
33
    throw new Error("Method not implemented.");
×
34
  }
35
  isSubsetOf(_other: ReadonlySetLike<unknown>): boolean {
NEW
36
    throw new Error("Method not implemented.");
×
37
  }
38
  isSupersetOf(_other: ReadonlySetLike<unknown>): boolean {
NEW
39
    throw new Error("Method not implemented.");
×
40
  }
41
  isDisjointFrom(_other: ReadonlySetLike<unknown>): boolean {
NEW
42
    throw new Error("Method not implemented.");
×
43
  }
44

45

46
  clear(): void {
47
    mapOrSetClear(this.externalArgs, this.carrier, this.entryPointer);
6✔
48
  }
49

50
  forEach(
51
    callbackfn: (key: K, key2: K, map: Set<K>) => void,
52
    thisArg?: any
53
  ): void {
54
    for (const pair of this.entries()) {
6✔
55
      callbackfn.call(thisArg || null, pair[1], pair[0], this);
12✔
56
    }
57
  }
58

59
  get size(): number {
UNCOV
60
    return hashMapSize(
×
61
      this.carrier.heap,
62
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
63
    );
64
  }
65

66
  [Symbol.iterator](): SetIterator<K> {
UNCOV
67
    return this.keys();
×
68
  }
69

70
  *entries(): SetIterator<[K, K]> {
71
    for (const nodePointer of hashmapNodesPointerIterator(
6✔
72
      this.carrier.heap,
73
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
74
    )) {
75
      const t = hashMapNodePointerToKey(this.carrier.heap, nodePointer);
12✔
76

77
      const key = entryToFinalJavaScriptValue(
12✔
78
        this.externalArgs,
79
        this.carrier,
80
        t
81
      );
82

83
      yield [key, key];
12✔
84
    }
85
  }
86

87
  *keys(): SetIterator<K> {
88
    for (const nodePointer of hashmapNodesPointerIterator(
6✔
89
      this.carrier.heap,
90
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
91
    )) {
92
      const t = hashMapNodePointerToKey(this.carrier.heap, nodePointer);
12✔
93

94
      yield entryToFinalJavaScriptValue(this.externalArgs, this.carrier, t);
12✔
95
    }
96
  }
97
  *values(): SetIterator<K> {
98
    for (const nodePointer of hashmapNodesPointerIterator(
36✔
99
      this.carrier.heap,
100
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
101
    )) {
102
      const t = hashMapNodePointerToKey(this.carrier.heap, nodePointer);
54✔
103

104
      yield entryToFinalJavaScriptValue(this.externalArgs, this.carrier, t);
54✔
105
    }
106
  }
107

108
  get [Symbol.toStringTag](): string {
109
    return Set.prototype[Symbol.toStringTag];
60✔
110
  }
111

112
  static get [Symbol.species](): SetConstructor {
UNCOV
113
    return Set;
×
114
  }
115

116
  public has(p: string | number): boolean {
117
    if (!(typeof p === "string" || typeof p === "number")) {
12!
UNCOV
118
      return false;
×
119
    }
120

121
    return (
12✔
122
      hashMapNodeLookup(
123
        this.carrier.heap,
124
        object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
125
        p
126
      ) !== 0
127
    );
128
  }
129

130
  public add(p: string | number): this {
131
    if (!(typeof p === "string" || typeof p === "number")) {
36!
UNCOV
132
      return this;
×
133
    }
134

135
    objectSet(
36✔
136
      this.externalArgs,
137
      this.carrier,
138
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
139
      p,
140
      undefined
141
    );
142

143
    return this;
36✔
144
  }
145

146
  public delete(p: string | number): boolean {
147
    if (!(typeof p === "string" || typeof p === "number")) {
6!
UNCOV
148
      return false;
×
149
    }
150

151
    return deleteObjectPropertyEntryByKey(
6✔
152
      this.carrier,
153
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
154
      p
155
    );
156
  }
157
}
158

159
export function createSetWrapper<K extends string | number>(
160
  externalArgs: ExternalArgs,
161
  globalCarrier: GlobalCarrier,
162
  entryPointer: number
163
): Set<K> {
164
  return new SetWrapper<K>(externalArgs, globalCarrier, entryPointer);
42✔
165
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc