Doubly linked list implementation in TypeScript.
Using npm:
npm install --save-dev @slimlib/list
No arguments. Constructs a new list object.
const list = new List();const list = new List<NodeType>();List provides an iterator using the [Symbol.iterator]() method. Most commonly used in cases where another statement/method consumes an iterable object.
Array.from(list);
for (const item of list) {
// something with item
}Inserts an element after the specified element (at the end of the list when called on the list itself).
element - a ListNode or List itself, after which to add the new element
data - an object that will become a ListNode
Inserts a range of elements after the specified element (at the end of the list when called on the list itself).
element - a ListNode or List itself, after which to add the range
begin - first ListNode of a range
end - last ListNode of a range
Inserts an element before the specified element (at the beginning of the list when called on the list itself).
element - a ListNode or List itself, before which to add the new element
data - an object that will become a ListNode
Inserts a range of elements before the specified element (at the beginning of the list when called on the list itself).
element - a ListNode or List itself, before which to insert the range
begin - first ListNode of a range
end - last ListNode of a range