bitmap-integers
Small utility module to convert between integer representations of bitmaps and arrays.
Usage
const bitmap = require('bitmap-integers');
Array to Value
Integer arrays
You can pass in an array of integers you want to set
bitmap.fromIntegerArray([1]);
bitmap.fromIntegerArray([2]);
bitmap.fromIntegerArray([1,2]);
bitmap.fromIntegerArray([3]);
bitmap.fromIntegerArray([1,3]);
bitmap.fromIntegerArray([2,3]);
bitmap.fromIntegerArray([1,2,3]);
Little endian boolean array
You can pass in an array of booleans in LE form
bitmap.fromBooleanArrayLE([true]);
bitmap.fromBooleanArrayLE([false, true]);
bitmap.fromBooleanArrayLE([true, true]);
bitmap.fromBooleanArrayLE([false, false, true]);
bitmap.fromBooleanArrayLE([true, false, true]);
bitmap.fromBooleanArrayLE([false, true, true]);
bitmap.fromBooleanArrayLE([true, true, true]);
Big endian boolean array
You can pass in an array of booleans in BE form
bitmap.fromBooleanArrayBE([true]);
bitmap.fromBooleanArrayBE([true, false]);
bitmap.fromBooleanArrayBE([true, true]);
bitmap.fromBooleanArrayBE([true, false, false]);
bitmap.fromBooleanArrayBE([true, false, true]);
bitmap.fromBooleanArrayBE([true, true, false]);
bitmap.fromBooleanArrayBE([true, true, true]);
Value to Array
Integer arrays
You can get an integer array from a value
bitmap.toIntegerArray(1);
bitmap.toIntegerArray(2);
bitmap.toIntegerArray(3);
bitmap.toIntegerArray(4);
bitmap.toIntegerArray(5);
bitmap.toIntegerArray(6);
bitmap.toIntegerArray(7);
Little endian boolean array
You can get an array of booleans in LE form
bitmap.toBooleanArrayLE(1);
bitmap.toBooleanArrayLE(2);
bitmap.toBooleanArrayLE(3);
bitmap.toBooleanArrayLE(4);
bitmap.toBooleanArrayLE(5);
bitmap.toBooleanArrayLE(6);
bitmap.toBooleanArrayLE(7);
Big endian boolean array
You can get an array of booleans in BE form
bitmap.toBooleanArrayBE(1);
bitmap.toBooleanArrayBE(2);
bitmap.toBooleanArrayBE(3);
bitmap.toBooleanArrayBE(4);
bitmap.toBooleanArrayBE(5);
bitmap.toBooleanArrayBE(6);
bitmap.toBooleanArrayBE(7);
Testing
npm test