Shared Lib
@avensio/shared bundles foundational TypeScript data structures (lists, queues, stacks, heaps), sorting utilities, math primitives, and comparator helpers that underpin other Avensio packages. Everything is dependency-free, works in Node.js, Deno, Bun, and browsers, and ships type definitions for first-class DX.
Install
bash
pnpm add @avensio/shared
# npm install @avensio/sharedImport
ts
import { List, Queue, createComparator } from '@avensio/shared'
const todo = new List([{ done: false, title: 'docs' }])
todo.comparator = createComparator('title')
todo.sort()
const queue = new Queue<string>(['alpha'])
queue.enqueue('beta')
console.log(queue.dequeue())Browser
html
<script src="https://unpkg.com/@avensio/shared"></script>
<script>
const queue = new Queue()
queue.add('task')
console.log(queue.remove())
</script>Modules
- Lists:
List,LinkedList,DoublyLinkedList,CyclicLinkedList - Queues:
Queue,LinkedQueue,PriorityQueue,Dequeue - Stacks: Array-backed + linked stacks
- Heaps: Binary heap + Fibonacci heap with
printHeap - Sorting: QuickSort and HeapSort on
ISortablecollections - Math/Utilities:
Point,Ordering,createComparator, helper interfaces
Use the sidebar to explore each family. Comparator usage is covered in Comparator Helpers. For the generated API docs, open Typed API (TypeDoc).
Graphs
Graph algorithms now live in @avensio/graph. That package exposes Graph, Vertex, and Edge classes plus serialization hooks and algorithms. Use this shared library for the supporting data structures those graphs rely on.
Benchmarks & Tests
pnpm test→ Vitest unit suite with coveragepnpm bench→ Micro-benchmarks recorded intest/benchmarks/README.md
Release & Docs
pnpm buildto produce ESM/CJS/IIFE bundlespnpm docs:devto run VitePress locallypnpm releaseto run tests, build artifacts, and generate the changelog (CHANGELOG.md)
See Changelog and Project History for notable milestones.
Happy building!