braillepatterndots-js
v1.0.3
Published
A simple library for braille pattern
Downloads
33
Readme
braillePatternDots-js
A simple library for braille pattern
Installation
npm install braillepatterndots-js
yarn add braillepatterndots-js
Functions and Usage
bchar(num: number): string
bcode(num: number): Array<boolean>
bpd(num: number): Braille
bpds(...nums: Array<number>): Array<Braille>
export default {}
interface Braille
bchar()
function bchar(num: number): string
- Javascript
const bchar = require("braillepatterndots-js").bchar;
console.log(bchar(123456));
- Typescript
import { bchar } from "braillepatterndots-js";
console.log(bchar(123456));
- Output
⠿
bcode()
function bcode(num: number): Array<boolean>
- Javascript
const bcode = require("braillepatterndots-js").bcode;
console.log(bcode(123456));
- Typescript
import { bcode } from "braillepatterndots-js";
console.log(bcode(123456));
- Output
[ true, true, true, true, true, true ]
bpd()
function bpd(num: number): Braille
- Javascript
const bpd = require("braillepatterndots-js").bpd;
console.log(bpd(123456));
- Typescript
import { bpd, Braille } from "braillepatterndots-js";
var braille: Braille = bpd(123456);
console.log(braille);
- Output
{ code: [ true, true, true, true, true, true ], char: '⠿' }
bpds()
function bpds(...nums: Array<number>): Array<Braille>
- Javascript
const bpds = require("braillepatterndots-js").bpds;
console.log(bpds(0, 123, 123456));
- Typescript
import { bpds, Braille } from "braillepatterndots-js";
var brailles: Array<Braille> = bpds(0, 123, 123456);
console.log(brailles);
- Output
[
{ code: [ false, false, false, false, false, false ], char: '⠀' },
{ code: [ true, true, true, false, false, false ], char: '⠇' },
{ code: [ true, true, true, true, true, true ], char: '⠿' }
]
default {}
export default {
bchar: bchar,
bcode: bcode,
bpd: bpd,
bpds: bpds,
};
- Javascript
const bpdjs = require("braillepatterndots-js").default;
console.log(bpdjs.bchar(123456));
console.log(bpdjs.bcode(123456));
console.log(bpdjs.bpd(123456));
console.log(bpdjs.bpds(0, 123, 123456));
- Typescript
import bpdjs, { Braille } from "braillepatterndots-js";
console.log(bpdjs.bchar(123456));
console.log(bpdjs.bcode(123456));
var braille: Braille = bpdjs.bpd(123456);
var brailles: Array<Braille> = bpdjs.bpds(0, 123, 123456);
console.log(braille);
console.log(brailles);
- Output
⠿
[ true, true, true, true, true, true ]
{ code: [ true, true, true, true, true, true ], char: '⠿' }
[
{ code: [ false, false, false, false, false, false ], char: '⠀' },
{ code: [ true, true, true, false, false, false ], char: '⠇' },
{ code: [ true, true, true, true, true, true ], char: '⠿' }
]
interface Braille
export interface Braille {
readonly code: Array<boolean>;
readonly char: string;
}
Test
yarn test