Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/minimal-bit-array
Minimal bit array that supports ndarray's accessors
https://github.com/mikolalysenko/minimal-bit-array
Last synced: about 2 months ago
JSON representation
Minimal bit array that supports ndarray's accessors
- Host: GitHub
- URL: https://github.com/mikolalysenko/minimal-bit-array
- Owner: mikolalysenko
- License: mit
- Created: 2013-06-28T01:41:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-31T18:29:34.000Z (over 10 years ago)
- Last Synced: 2024-10-19T00:19:21.465Z (2 months ago)
- Language: JavaScript
- Size: 127 KB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
minimal-bit-array
=================
A minimalistic bit array implementation that is compatible with ndarray's internals.[![testling badge](https://ci.testling.com/mikolalysenko/minimal-bit-array.png)](https://ci.testling.com/mikolalysenko/minimal-bit-array)
[![build status](https://secure.travis-ci.org/mikolalysenko/minimal-bit-array.png)](http://travis-ci.org/mikolalysenko/minimal-bit-array)
## Example
```javascript
var BitArray = require("minimal-bit-array")
var x = new BitArray(100)x.set(5, true)
console.log(x.get(4)) //Prints false
console.log(x.get(5)) //Prints true
```## Install
npm install minimal-bit-array
## API```javascript
var BitArray = require("minimal-bit-array")
```### `BitArray(length)`
Creates a bit array with the given length### `array.get(i)`
Retrieves the bit at location i### `array.set(i, v)`
Sets the bit at location i to v### `array.toJSON()`
Serializes the array to a JSON object### `BitArray.fromJSON(x)`
Deserializes a JSON object into a bit array.## Credits
(c) 2013 Mikola Lysenko. MIT License