function braille_pattern(blocks)
{
if(!(blocks instanceof Array) || blocks.length > 8 || blocks.length < 0)
throw new TypeError("Only accept an array in max of 8 elements with 0/1 or true/false.");
// value table
const table = [1, 2, 4, 64, 8, 16, 32, 128];
// codepoint offset
let offset = 0;
// calculate
blocks.forEach((val, i) => {
if(val == 1 || val == true) offset += table[i];
});
// eval to character
return String.fromCodePoint(0x2800 + offset);
}
braille_pattern([1,1,1]);
=> ⠇('\u2807')
braille_pattern([1,1,1,0,0,1]);
=> ⠗('\u2817')
braille_pattern([1,1,1,1,1,1,1,1]);
=> ⣿('\u28ff')
⡏⣭⡍⡇⠄⠅⡃⡏⣭⡍⡇
⠧⠭⠥⠇⡜⡞⠅⠧⠭⠥⠇
⠻⡥⠹⢽⢇⣱⣹⢵⡠⢵⠆
⡥⠥⠥⡍⣆⠊⠌⡋⠼⢨⠅
⡇⠿⠇⡇⣵⣳⣱⢵⣉⢜⠅
⠉⠉⠉⠁⠉⠉⠈⠉⠀⠉⠁
I tried to use a braille pattern art to make a scannable qr code.
but clearly, this can not take any sense. cuz the line height.