@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
61 lines • 1.62 kB
TypeScript
/**
* Return the last index in the array that matches the predicate
*/
export declare function findLastIndex<T>(array: T[], predicate: (value: T) => boolean): number;
/**
* We want to use this if we only need push/pop/shift method
* without random access.
* The shift() method should be cheaper than regular array.
*/
export declare class LinkedList<T> {
private _length;
private head;
private tail;
private pointer;
constructor();
get length(): number;
/**
* Add to the end of the list
*/
push(data: T): void;
/**
* Add to the beginning of the list
*/
unshift(data: T): void;
insertAfter(after: T, data: T): void;
pop(): T | null;
shift(): T | null;
first(): T | null;
last(): T | null;
/**
* Delete the first item thats search from head
*/
deleteFirst(item: T): boolean;
/**
* Delete the first item search from tail.
*/
deleteLast(item: T): boolean;
/**
* Move an existing item to the head of the list.
* If the item is not found, do nothing.
*/
moveToHead(item: T): void;
/**
* Move an existing item to the second position of the list.
* If the item is not found, do nothing.
*/
moveToSecond(item: T): void;
next(): IteratorResult<T>;
[Symbol.iterator](): IterableIterator<T>;
values(): IterableIterator<T>;
clear(): void;
toArray(): T[];
map<U>(fn: (t: T) => U): U[];
/**
* Check if the item is in the list.
* @returns
*/
has(item: T): boolean;
private findNode;
}
//# sourceMappingURL=array.d.ts.map