Skip to content

Commit c368f01

Browse files
committed
typescript-iteration
1 parent 27a7206 commit c368f01

12 files changed

Lines changed: 54 additions & 27 deletions

src/allocator/functional.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,5 +867,5 @@ function blockSelfAddress(dataAddress: number): number {
867867
* @param size - alignment value
868868
*/
869869
export function align(addr: number, size: Pow2): number {
870-
return size--, (addr + size) & ~size;
870+
return (size--, (addr + size) & ~size);
871871
}

src/internal/WeakValueMap.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ export class WeakValueMap<K, V> implements Map<K, V> {
108108
this.map.clear();
109109
}
110110

111-
*[Symbol.iterator](type?: typeof KEYS | typeof VALUES | typeof KEYS_VALUES): MapIterator<[K, V]> {
111+
*[Symbol.iterator](
112+
type?: typeof KEYS | typeof VALUES | typeof KEYS_VALUES
113+
): MapIterator<[K, V]> {
112114
for (const [key, weak] of this.map) {
113115
const v = weak.deref();
114116
if (v === undefined) {

src/internal/arrayWrapper.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,20 @@ export class ArrayWrapper
8484
);
8585
}
8686

87-
public getOwnPropertyDescriptor(target: Record<string, unknown>, prop: any): {
88-
readonly configurable: false;
89-
readonly enumerable: false;
90-
readonly writable: true;
91-
} | {
92-
readonly configurable: false;
93-
readonly enumerable: true;
94-
} | undefined {
87+
public getOwnPropertyDescriptor(
88+
target: Record<string, unknown>,
89+
prop: any
90+
):
91+
| {
92+
readonly configurable: false;
93+
readonly enumerable: false;
94+
readonly writable: true;
95+
}
96+
| {
97+
readonly configurable: false;
98+
readonly enumerable: true;
99+
}
100+
| undefined {
95101
if (prop === "length") {
96102
return getOwnPropertyDescriptorLENGTH;
97103
}

src/internal/hashmap/hashFunctionsStuff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function hashString(str: string): number {
4747
let h = 0 | 0;
4848

4949
for (let point = 0, nextCode = 0, i = 0; i !== strLen; ) {
50-
(point = str.charCodeAt(i)), (i += 1);
50+
((point = str.charCodeAt(i)), (i += 1));
5151

5252
if (point >= 0xd800 && point <= 0xdbff) {
5353
if (i === strLen) {

src/internal/hashmap/hashmap.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,10 @@ export function hashMapNodePointerToValue(nodePointer: number): number {
483483
return nodePointer + hashmapNode_VALUE_POINTER_place;
484484
}
485485

486-
export function hashMapNodePointerToKey(heap: Heap, nodePointer: number): number {
486+
export function hashMapNodePointerToKey(
487+
heap: Heap,
488+
nodePointer: number
489+
): number {
487490
return hashmapNode_KEY_POINTER_get(heap, nodePointer);
488491
}
489492

@@ -602,7 +605,10 @@ function shouldRehash(
602605
return fullBuckets / buckets > loadFactor;
603606
}
604607

605-
export function* hashmapNodesPointerIterator(heap: Heap, mapPointer: number): Generator<number, void, unknown> {
608+
export function* hashmapNodesPointerIterator(
609+
heap: Heap,
610+
mapPointer: number
611+
): Generator<number, void, unknown> {
606612
let iteratorToken = 0;
607613

608614
while (

src/internal/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface InternalAPI {
5858
replaceCarrierContent(carrier: GlobalCarrier): void;
5959
getEntryPointer(): number;
6060
destroy(): void;
61-
[INTERNAL_API_SYMBOL]() : InternalAPI;
61+
[INTERNAL_API_SYMBOL](): InternalAPI;
6262
}
6363

6464
// A mode backward compat ArrayBufferLike

src/internal/objectWrapper.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ export class ObjectWrapper
7777
public getOwnPropertyDescriptor(
7878
target: Record<string, unknown>,
7979
p: PropertyKey
80-
): {
81-
readonly configurable: true;
82-
readonly enumerable: true;
83-
} | undefined {
80+
):
81+
| {
82+
readonly configurable: true;
83+
readonly enumerable: true;
84+
}
85+
| undefined {
8486
if (this.has(target, p)) {
8587
return getOwnPropertyDescriptorHAS;
8688
}

src/internal/profileStringDecodeInto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function stringEncodeInto2(uint8, from, str) {
1717
const resArr = uint8;
1818

1919
for (let point = 0, nextCode = 0, i = 0; i !== strLen; ) {
20-
(point = str.charCodeAt(i)), (i += 1);
20+
((point = str.charCodeAt(i)), (i += 1));
2121
if (point >= 0xd800 && point <= 0xdbff) {
2222
if (i === strLen) {
2323
resArr[(resPos += 1)] = 0xef /*0b11101111*/;

src/internal/setWrapper.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
mapOrSetClear,
66
} from "./objectWrapperHelpers";
77

8-
98
import { BaseProxyTrap } from "./BaseProxyTrap";
109
import {
1110
hashMapNodeLookup,
@@ -42,7 +41,6 @@ export class SetWrapper<K extends string | number>
4241
throw new Error("Method not implemented.");
4342
}
4443

45-
4644
clear(): void {
4745
mapOrSetClear(this.externalArgs, this.carrier, this.entryPointer);
4846
}

src/internal/store.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export function saveStringOrNumber(
5858
}
5959
}
6060

61-
export function saveString({ heap, allocator }: GlobalCarrier, value: string): number {
61+
export function saveString(
62+
{ heap, allocator }: GlobalCarrier,
63+
value: string
64+
): number {
6265
const stringBytesLength = stringLengthV2(value);
6366
const stringDataPointer = allocator.calloc(stringBytesLength);
6467
stringEncodeInto(heap.u8, stringDataPointer, value);
@@ -76,7 +79,10 @@ export function saveString({ heap, allocator }: GlobalCarrier, value: string): n
7679
return stringPointer;
7780
}
7881

79-
export function saveNumber({ heap, allocator }: GlobalCarrier, value: number): number {
82+
export function saveNumber(
83+
{ heap, allocator }: GlobalCarrier,
84+
value: number
85+
): number {
8086
const numberPointer = allocator.calloc(number_size);
8187

8288
number_set_all(heap, numberPointer, ENTRY_TYPE.NUMBER, value);
@@ -322,7 +328,10 @@ export function compareStringOrNumberEntriesInPlace(
322328
);
323329
}
324330

325-
export function readNumberOrString(heap: Heap, pointer: number): string | number {
331+
export function readNumberOrString(
332+
heap: Heap,
333+
pointer: number
334+
): string | number {
326335
const type: ENTRY_TYPE.NUMBER | ENTRY_TYPE.STRING = typeOnly_type_get(
327336
heap,
328337
pointer

0 commit comments

Comments
 (0)