1.0.2 • Published 4 years ago

bin-braille-parser v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

This readme has a Brazilian Portuguese version (pt-br).

npm version npm downloads

How it works

Binary Braille, nicknamed BinBraille, is an abstraction from conventional Braille, in Braille each letter, symbol or number is represented by 6 possible points, where with the combination of these points the letters are formed, following an example:

Image of the braille

In Binary Braille, we change the points marked by 1 and where we don't mark anything we put 0, for this variation of zeros and one, the abstraction is called Binary Braille. The same pattern of letters in the image above would look like this in the Binary Braille system:

[ "1", "0" ],  [ "1", "0" ],  [ "1", "1" ],  [ "1", "1" ]
[ "0", "0" ],  [ "1", "0" ],  [ "0", "0" ],  [ "0", "1" ]
[ "0", "0" ],  [ "0", "0" ],  [ "0", "0" ],  [ "0", "0" ]
     a              b		   c		  d

Coverage

At the moment, character coverage is throughout the alphabet, numbers, single characters and complex symbols:

(",", ";", ":", "?", "!", "@", "-", "*", "&", "$", ">", "<", "=", "+", "/", "%", "©")

However, it still doesn't support specificities of other languages

Demo

Go to this site and there you can test all the features of the parser.

Installing

Via npm or yarn

npm i bin-braille-parser # or yarn add bin-braille-parser

Disclaimer

This parser follows the Braille language in Brazilian standard, if you want to contribute with the conversion to other languages, feel free and submit your pull request. Check this official language support document.

Usage

const parserTextToBinBraille = require('bin-braille-parser')

parserTextToBinBraille("Jonh snow")

/* The return is
 [ 
  [ [ '0', '1' ], [ '0', '0' ], [ '0', '1' ] ], Character to say that the next letter is capitalized.
  [ [ '0', '1' ], [ '1', '1' ], [ '0', '0' ] ], J
  [ [ '1', '0' ], [ '0', '1' ], [ '1', '0' ] ], o
  [ [ '1', '1' ], [ '0', '1' ], [ '1', '0' ] ], n
  [ [ '1', '0' ], [ '1', '1' ], [ '0', '0' ] ], h
  [ [ '0', '0' ], [ '0', '0' ], [ '0', '0' ] ], 
  [ [ '0', '1' ], [ '1', '0' ], [ '1', '0' ] ], s
  [ [ '1', '1' ], [ '0', '1' ], [ '1', '0' ] ], n
  [ [ '1', '0' ], [ '0', '1' ], [ '1', '0' ] ], o
  [ [ '0', '1' ], [ '1', '1' ], [ '0', '1' ] ]  w
  ]
*/

Running the tests

npm run test #or yarn test

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago