This project is part of the @thi.ng/umbrella monorepo.
Double-linked list with comprehensive set of operations.
- ES6 iterator support
- Stack & queue API (front and/or back)
- Random node access (read / write, O(n/2))
- Node insertion (also w/ custom comparator)
- Node finding (O(n))
- Node swaps (O(1))
- Reversing (O(n/2))
- Rotation (left / right) (O(1))
- Shuffling (configurable, support custom PRNG)
- Sorting (Merge sort, w/ custom comparator)
- Slicing (sublist copies)
- Splicing (delete and/or insert)
release()
(emptying, GC friendly)concat()
/into()
map()
/filter()
/reduce()
compare()
/equiv()
toJSON()
transform (-> array)
STABLE - used in production
yarn add @thi.ng/dcons
Package sizes (gzipped, pre-treeshake): ESM: 1.98 KB / CJS: 2.06 KB / UMD: 2.15 KB
- @thi.ng/api
- @thi.ng/checks
- @thi.ng/compare
- @thi.ng/equiv
- @thi.ng/errors
- @thi.ng/random
- @thi.ng/transducers
- tslib
cons()
first()
drop()
setHead()
into()
push()
peek()
pop()
setTail()
.length
nth()
nthCell()
setNth()
insertBefore()
insertAfter()
insertBeforeNth()
insertAfterNth()
insertSorted()
find()
findWith()
copy()
concat()
slice()
splice()
swap()
shuffle()
sort()
reverse()
rotateLeft()
rotateRight()
release()
TODO
Karsten Schmidt
© 2017 - 2020 Karsten Schmidt // Apache Software License 2.0