print-2d-bit-array

0.1.0 • Public • Published

print-2d-bit-array

Prints 2D-arrays of bits. Supports ndarray.

Build Status

testling badge

Example

var printBitArray = require('print-2d-bit-array');
var input = [
    [1, 1, 1, 1, 1],
    [1, 0, 0, 0, 1],
    [1, 0, 1, 0, 1],
    [1, 0, 0, 0, 1],
    [1, 1, 1, 1, 1]
];
 
console.log(printBitArray(input, {
    doubleWidth: true
}));
 
/* Outputs: 
██████████
██░░░░░░██
██░░██░░██
██░░░░░░██
██████████
*/

Options

  • doubleWidth (boolean) - Whether to print two characters instead of one, to make up for thinner characters. Default: false
  • characters: (array) - Characters to use when printing. First element represents 0, second represents 1. Default: ['░', '█']

Installing

Install the module using npm:

npm install print-2d-bit-array

Also works in the browser using browserify.

/print-2d-bit-array/

    Package Sidebar

    Install

    npm i print-2d-bit-array

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • rexxars