

This project is part of the
@thi.ng/umbrella monorepo.
About
1D / 2D bit field implementations.
All implementations are backed by typed arrays. Due to Uint32Array
backing the width is always rounded to a multiple of 32.
Status
STABLE - used in production
Installation
yarn add @thi.ng/bitfield
// ES module
<script type="module" src="https://unpkg.com/@thi.ng/bitfield?module" crossorigin></script>
// UMD
<script src="https://unpkg.com/@thi.ng/bitfield/lib/index.umd.js" crossorigin></script>
Package sizes (gzipped, pre-treeshake): ESM: 947 bytes / CJS: 1008 bytes / UMD: 1.06 KB
Dependencies
API
Generated API docs
import { BitField, BitMatrix } from "@thi.ng/bitfield";
const field = new BitField(16);
field.setAt(0);
field.setAt(31, true);
field.at(0)
field.at(1)
field.toString();
field.resize(64)
const mat = new BitMatrix(8, 32);
for(let i = 0; i < 8; i++) mat.setAt(i, i);
mat.at(7, 7);
mat.toString();
Authors
Karsten Schmidt
License
© 2016 - 2020 Karsten Schmidt // Apache Software License 2.0