Add array methods: findIndex, reduce, some, every (#49)

This commit is contained in:
Igor
2018-03-25 13:13:53 +02:00
committed by Daniel Wirtz
parent 38a025950e
commit 710fcefd72
6 changed files with 2949 additions and 4 deletions

4
std/assembly.d.ts vendored
View File

@ -273,12 +273,16 @@ declare class Array<T> {
length: i32;
/** Constructs a new array. */
constructor(capacity?: i32);
every(callbackfn: (element: T, index: i32, array?: Array<T>) => bool): bool;
findIndex(predicate: (element: T, index: i32, array?: Array<T>) => bool): i32;
includes(searchElement: T, fromIndex?: i32): bool;
indexOf(searchElement: T, fromIndex?: i32): i32;
lastIndexOf(searchElement: T, fromIndex?: i32): i32;
push(element: T): void;
pop(): T;
reduce<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;