Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
36 lines (32 loc) · 1.06 KB

File metadata and controls

36 lines (32 loc) · 1.06 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/** @noSelfInFile */
import { __TS__Iterator } from "./Iterator";
function arrayLikeStep(this: ArrayLike<unknown>, index: number): LuaMultiReturn<[number, unknown] | []> {
index += 1;
if (index > this.length) return $multi();
return $multi(index, this[index]);
}
const arrayLikeIterator: (
this: void,
arr: ArrayLike<unknown> | Iterable<unknown>
) => LuaIterable<LuaMultiReturn<[number, unknown]>> = (arr => {
if (typeof arr.length === "number") return $multi(arrayLikeStep, arr, 0);
return __TS__Iterator(arr);
}) as any;
export function __TS__ArrayFrom(
this: void,
arrayLike: ArrayLike<unknown> | Iterable<unknown>,
mapFn?: (this: unknown, element: unknown, index: number) => unknown,
thisArg?: unknown
): unknown[] {
const result = [];
if (mapFn === undefined) {
for (const [, v] of arrayLikeIterator(arrayLike)) {
result.push(v);
}
} else {
for (const [i, v] of arrayLikeIterator(arrayLike)) {
result.push(mapFn.call(thisArg, v, i - 1));
}
}
return result;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.