Implement Array#map, Array#forEach, Array#filter, Array#reduceRight (#81)

This commit is contained in:
Max Graey
2018-04-22 23:15:38 +03:00
committed by Daniel Wirtz
parent 05117f9ee3
commit fac0fc59b5
6 changed files with 3648 additions and 400 deletions

6
std/assembly.d.ts vendored
View File

@ -337,14 +337,18 @@ declare class Array<T> {
lastIndexOf(searchElement: T, fromIndex?: i32): i32;
push(element: T): void;
pop(): T;
forEach(callbackfn: (value: T, index: i32, array: Array<T>) => void): void;
map<U>(callbackfn: (value: T, index: i32, array: Array<T>) => U): Array<U>;
filter(callbackfn: (value: T, index: i32, array: Array<T>) => bool): Array<T>;
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U, initialValue: U): U;
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array<T>) => U, initialValue: U): U;
shift(): T;
some(callbackfn: (element: T, index: i32, array?: Array<T>) => bool): bool;
unshift(element: T): i32;
slice(from: i32, to?: i32): T[];
splice(start: i32, deleteCount?: i32): void;
reverse(): T[];
sort(comparator?: (a: T, b: T) => i32): T[];
sort(comparator?: (a: T, b: T) => i32): this;
}
/** Class representing a C-like array of values of type `T` with limited capabilities. */