Import each one by its subpath, knotkit/<name>.
Collections
Queues, heaps, sets, maps, interval indexes, sorted blocks, caches, and rate limits.
- bitsetProvides exact membership, cardinality, set algebra, and order statistics over unsigned 32-bit ids, in one flat bitmap or 65,536-id chunks
- cacheBounds an in-memory key-value store by entry count or total weight, with least-recently-used, SIEVE, S3-FIFO, or caller-supplied eviction and optional expiry
- dequeQueues elements at both ends in O(1) amortized time, over array and Float64Array ring buffers, with an optional fixed capacity that turns the queue into a sliding window
- disjoint-setTracks which elements belong to the same set, with dense-index, object, and struct-of-arrays layouts
- frequency-tableMaintains exact counts, prefix sums, range sums, and rank selection over a fixed integer domain
- heapProvides binary and k-ary min/max heaps plus indexed priority queues, ordered by caller-supplied comparators
- interval-indexIndexes closed intervals over a caller-supplied order and finds every interval that holds a point or overlaps a range
- ordered-mapStores keys in comparator order with insertion, deletion, rank, selection, ceiling, floor, and range scans in either direction, as a B-tree or an indexed skip list
- rate-limitLimits each client's request weight by a fixed window, a sliding window, or a token bucket, returning the least whole millisecond a denial must wait
- snapshot-setKeeps every snapshot readable for the lifetime of the set, at O(1) mutation and snapshot cost
- sorted-blockPacks byte-keyed entries, given in ascending key order, into one immutable prefix-compressed block with point reads, seeks, and range scans
- sorted-mergeLazily merges sorted iterables in comparator order, preserving duplicates and source order on ties
Search and text
Prefix lookup, posting lists, and ranked retrieval.
- inverted-indexIndexes records by exact keys and scans sorted record IDs for one key or the union of several, using packed posting lists
- prefix-indexEnumerates a bounded number of distinct strings that start with a prefix in UTF-16 order
- term-indexIndexes tokenized documents with exact term counts and ranks matching document IDs by BM25
- trieResolves delimiter-separated token keys by longest prefix in a single walk
Graphs and optimization
Traversal, shortest paths, rewriting, and search.
- combinatoricsCounts permutations, combinations, cycles, and set partitions exactly or in log space
- e-graphPropagates equalities through expressions and extracts a minimum-cost equivalent expression
- evolutionRuns deterministic population evolution with index-based parent selection and immutable permutation operators
- graphProvides breadth-first search, Dijkstra, topological order, and connected components over integer-vertex graphs, stored as adjacency lists, compressed sparse rows, or an adjacency matrix
Randomness and statistics
Seeded sources, sampling, distributions, tests, sketches, and static filters.
- distanceCompares vectors, probability distributions, and sets and exposes each rule’s mathematical guarantees
- distributionComputes probabilities, quantiles, moments, and seeded draws for named and caller-defined distributions
- hypothesis-testComputes t-test, ANOVA, rank-test, goodness-of-fit, and exact-test p-values for counts, samples, and contingency tables
- prngGenerates seeded pseudorandom numbers and unbiased integers for reproducible simulations and tests
- samplingDraws unbiased subsets, pairs, shuffles, and weighted samples over injected randomness
- scalar-sketchProvides reducible Bloom filter, HyperLogLog, Count-Min Sketch, and MinHash sketches over four scalar domains
- static-filterBuilds immutable Binary Fuse membership filters over a known set of byte keys, with no false negatives and fewer bytes than a Bloom filter at the same false-positive rate
Serialization and utilities
Hashing, order-preserving keys, error classes, and binary envelopes.
- casAddresses wire-envelope artifacts by content hash and stores them through an injected backend
- errorsProvides the base error classes every Knotkit package throws from, discriminated by package, category, and cause
- hashComputes deterministic non-cryptographic XXH64 hashes, identical across browsers, Node.js, and Bun
- key-encodingEncodes integers, doubles, byte strings, strings, and tuples of them as byte keys whose unsigned byte order matches the values' order
- wireEncodes bounded binary envelopes and element codecs for Knotkit structures
No module matches. Try describing the task on Choose a module.