@astrocreep/sparse-set
v1.0.0
Published
sparse set implementation
Maintainers
Readme
A sparse set implementation in TypeScript. Sparse set has a fixed size that needs to be provided in the constructor. Order of the values is not guaranteed!
Installation
npm install @astrocreep/sparse-setUsage
import { SparseSet } from '@astrocreep/sparse-set'
const set = new SparseSet(10)
set.add(1)
set.add(2)
set.add(3)
set.remove(2)
set.has(1) // true
set.has(2) // false
// iterate over all values
for (const value of set) {
console.log(value)