Skip to content

Commit be7a278

Browse files
committed
Optimize array.toObject
1 parent 743b5d9 commit be7a278

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lualib/ArrayToObject.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function __TS__ArrayToObject<T>(this: void, array: T[]): Record<number, T> {
22
const object: Record<number, any> = {};
3-
for (let i = 0; i < array.length; i += 1) {
4-
object[i] = array[i];
3+
for (const i of $range(1, array.length)) {
4+
object[i - 1] = array[i - 1];
55
}
66
return object;
77
}

0 commit comments

Comments
 (0)