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): ESM: 2.0KB / CJS: 2.1KB / UMD: 2.2KB
- @thi.ng/api
- @thi.ng/checks
- @thi.ng/compare
- @thi.ng/equiv
- @thi.ng/errors
- @thi.ng/random
- @thi.ng/transducers
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