zo-containers-js

1.1.6 • Public • Published

containers

Some utility containers: BitArray, OrderedArray

  • npm install zo-containers-js --save

BitArray

const { BitArray } = require('zo-containers-js');
let ba = new BitArray(8);
ba.set(5, 1); 
ba.get(5); //1

let entries = ba.entries();
for (let [i, v] of entries) {
    //...
}

OrderedArray

const { OrderedArray } = require('zo-containers-js');
let oa = new OrderedArray((a, b) => a - b);
oa.add(6);
oa.add(8);
oa.add(2);
oa.add(3);
console.log(oa);  // [ 2, 3, 6, 8 ]

let oa2 = new OrderedArray((a, b) => a - b);
oa2.add(5);
oa2.add(3);

oa.merge(oa2);
console.log(oa);  // [ 2, 3, 3, 5, 6, 8 ]

Package Sidebar

Install

npm i zo-containers-js

Weekly Downloads

9

Version

1.1.6

License

MIT

Unpacked Size

25.6 kB

Total Files

8

Last publish

Collaborators

  • zero0-1one