UNPKG

1.41 kBTypeScriptView Raw
1export class ListNode {
2 /**
3 * @type {this|null}
4 */
5 next: ListNode | null;
6 /**
7 * @type {this|null}
8 */
9 prev: ListNode | null;
10}
11/**
12 * @template {ListNode} N
13 */
14export class List<N extends ListNode> {
15 /**
16 * @type {N | null}
17 */
18 start: N | null;
19 /**
20 * @type {N | null}
21 */
22 end: N | null;
23 len: number;
24}
25export function create<N extends ListNode>(): List<N>;
26export function isEmpty<N extends ListNode>(queue: List<N>): boolean;
27export function remove<N extends ListNode>(queue: List<N>, node: N): N;
28export function removeNode<N extends ListNode>(queue: List<N>, node: N): N;
29export function insertBetween<N extends ListNode>(queue: List<N>, left: N | null, right: N | null, node: N): void;
30export function replace<N extends ListNode>(queue: List<N>, node: N, newNode: N): void;
31export function pushEnd<N extends ListNode>(queue: List<N>, n: N): void;
32export function pushFront<N extends ListNode>(queue: List<N>, n: N): void;
33export function popFront<N extends ListNode>(list: List<N>): N | null;
34export function popEnd<N extends ListNode>(list: List<N>): N | null;
35export function map<N extends ListNode, M>(list: List<N>, f: (arg0: N) => M): M[];
36export function toArray<N extends ListNode>(list: List<N>): N[];
37export function forEach<N extends ListNode, M>(list: List<N>, f: (arg0: N) => M): void;
38//# sourceMappingURL=list.d.ts.map
\No newline at end of file