ts-linked-list
![Dev Dependencies](https://david-dm.org/tuelsch/ts-linked-list/dev-status.svg)
![Known Vulnerabilities](https://snyk.io/test/github/tuelsch/ts-linked-list/badge.svg?targetFile=package.json)
Yet another yet another doubly linked list, written in TypeScript. It supports
iterators using a generator function with Symbol.iterator
, fast index getter in O(n/2) time,
reversible forEach
, map
, filter
and reduce
methods, insertBefore
and insertAfter
any node as well as generics for TypeScript users.
Installation
npm install ts-linked-list
Usage
import LinkedList from 'ts-linked-list';
const list = new LinkedList(1, 'two', { n: 3 }, () => 4);
const typedList = new LinkedList<number>(1, 2, 3);
const wildList = new LinkedList<any>(1, 'two', () => 3, [4]);
const listFromArray = LinkedList.from([1, 2, 3, 'whatever']);
list.forEach(data => doSomethingUseful(data));
Documentation
https://tuelsch.github.io/ts-linked-list/.