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

Bnaya / objectbuffer / 16262692456

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

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

80.39
/src/internal/objectWrapper.ts
1
import type { ExternalArgs, GlobalCarrier } from "./interfaces";
2
import {
3
  getObjectPropertiesEntries,
4
  deleteObjectPropertyEntryByKey,
5
  objectGet,
6
  objectSet,
7
} from "./objectWrapperHelpers";
8

9
import { INTERNAL_API_SYMBOL } from "./symbols";
10
import {
11
  IllegalObjectPropConfigError,
12
  UnsupportedOperationError,
13
} from "./exceptions";
14
import { BaseProxyTrap } from "./BaseProxyTrap";
15
import { hashMapNodeLookup } from "./hashmap/hashmap";
16
import { object_pointerToHashMap_get } from "./generatedStructs";
17

18
const getOwnPropertyDescriptorHAS = {
174✔
19
  configurable: true,
20
  enumerable: true,
21
} as const;
22

23
export class ObjectWrapper
24
  extends BaseProxyTrap
25
  implements ProxyHandler<Record<string, unknown>>
26
{
27
  public get(target: Record<string, unknown>, p: PropertyKey): any {
28
    if (p === INTERNAL_API_SYMBOL) {
9,276✔
29
      return this;
1,944✔
30
    }
31

32
    if (typeof p === "symbol") {
7,332✔
33
      return undefined;
882✔
34
    }
35

36
    return objectGet(
6,450✔
37
      this.externalArgs,
38
      this.carrier,
39
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
40
      p
41
    );
42
  }
43

44
  public deleteProperty(
45
    target: Record<string, unknown>,
46
    p: PropertyKey
47
  ): boolean {
48
    if (typeof p === "symbol") {
18!
49
      return false;
×
50
    }
51

52
    return deleteObjectPropertyEntryByKey(
18✔
53
      this.carrier,
54
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
55
      p
56
    );
57
  }
58

59
  public enumerate(): PropertyKey[] {
60
    const gotEntries = getObjectPropertiesEntries(
×
61
      this.carrier,
62
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
63
    );
64

65
    return gotEntries.map((e) => e.key);
×
66
  }
67

68
  public ownKeys(): string[] {
69
    const gotEntries = getObjectPropertiesEntries(
888✔
70
      this.carrier,
71
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer)
72
    );
73

74
    return gotEntries.map((e) => e.key.toString());
1,764✔
75
  }
76

77
  public getOwnPropertyDescriptor(
78
    target: Record<string, unknown>,
79
    p: PropertyKey
80
  ): {
81
    readonly configurable: true;
82
    readonly enumerable: true;
83
  } | undefined {
84
    if (this.has(target, p)) {
1,218!
85
      return getOwnPropertyDescriptorHAS;
1,218✔
86
    }
87

UNCOV
88
    return undefined;
×
89
  }
90

91
  public has(target: Record<string, unknown>, p: PropertyKey): boolean {
92
    if (p === INTERNAL_API_SYMBOL) {
1,224✔
93
      return true;
6✔
94
    }
95

96
    if (typeof p === "symbol") {
1,218!
UNCOV
97
      return false;
×
98
    }
99

100
    return (
1,218✔
101
      hashMapNodeLookup(
102
        this.carrier.heap,
103
        object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
104
        p
105
      ) !== 0
106
    );
107
  }
108

109
  public set(
110
    target: Record<string, unknown>,
111
    p: PropertyKey,
112
    value: any
113
  ): boolean {
114
    if (typeof p === "symbol") {
324✔
115
      throw new IllegalObjectPropConfigError();
12✔
116
    }
117

118
    objectSet(
312✔
119
      this.externalArgs,
120
      this.carrier,
121
      object_pointerToHashMap_get(this.carrier.heap, this.entryPointer),
122
      p,
123
      value
124
    );
125

126
    return true;
300✔
127
  }
128

129
  public isExtensible() {
UNCOV
130
    return true;
×
131
  }
132

133
  public preventExtensions(): boolean {
UNCOV
134
    throw new UnsupportedOperationError();
×
135
  }
136

137
  public setPrototypeOf(): boolean {
138
    throw new UnsupportedOperationError();
6✔
139
  }
140

141
  public defineProperty(): // target: Record<string, unknown>,
142
  // p: PropertyKey,
143
  // attributes: PropertyDescriptor
144
  boolean {
145
    throw new UnsupportedOperationError();
6✔
146
    // if (
147
    //   typeof p === "symbol" ||
148
    //   attributes.enumerable === false ||
149
    //   attributes.get ||
150
    //   attributes.set
151
    // ) {
152
    //   throw new IllegalObjectPropConfigError();
153
    // }
154

155
    // return Object.defineProperty(target, p, attributes);
156
  }
157
}
158

159
export function createObjectWrapper<T = any>(
160
  externalArgs: ExternalArgs,
161
  globalCarrier: GlobalCarrier,
162
  entryPointer: number
163
): T {
164
  return new Proxy(
768✔
165
    { objectBufferWrapper: "objectBufferWrapper" },
166
    new ObjectWrapper(externalArgs, globalCarrier, entryPointer)
167
  ) as any;
168
}
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