0.0.6 • Published 6 years ago

simple-bitarray v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

BitArray

Installation

A very simple bitarray implementation, it uses Uint8Array under the hood, so at worst you'll have 7 extra bits.

I don't know if Node 0.10.x has Uint8Array, if it does then it should work, but I haven't tested.

$ npm install bitarray

Usage

var bitarray = require('simple-bitarray');
// Makes a bitarray of length 10
var arr = bitarray(10);
// Set the 0th 2nd and 3rd bit
// Indexing starts at 0
arr.set(0, 2, 3);
arr.get(2); // {2: 1}
arr.get(5) // {5: 0}
// The output is formatted to space per 8 bits
// for easier reading
arr.toString() // 10110000 00

Tests

$ npm test

License

MIT

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago