@siakhooi/box-drawing

1.5.5 • Public • Published

ts-box-drawing

npm package to draw box using unicode characters

GitHub Code Style: Google GitHub last commit GitHub tag (latest by date) GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests GitHub top language GitHub language count Lines of code GitHub repo size GitHub code size in bytes Workflow workflow workflow Release GitHub release (latest by date) GitHub all releases GitHub Release Date Release npm npm npm type definitions

Quality-npms.io npms.io (final) npms.io (final) npms.io (final) npms.io (final)

Quality-CodeClimate Maintainability Code Climate maintainability Code Climate issues Code Climate technical debt Test Coverage Quality-Sonar Code Smells Duplicated Lines (%) Bugs Vulnerabilities Technical Debt Maintainability Rating Security Rating Reliability Rating Quality Gate Status Lines of Code Coverage Sonar Violations (short format) Sonar Violations (short format) Sonar Violations (short format) Sonar Violations (short format) Sonar Violations (short format) Sonar Violations (short format) Sonar Violations (long format)

Generic badge Generic badge visitors

Locations

Demo

Source Code

Distribution

Code Quality

Reference

Usage

See Demo in Replit: https://replit.com/@siakhooi/siakhooibox-drawing-Demo?v=1

Simple Text

see Demo_HelloWorld

const x = require('@siakhooi/box-drawing');

x.drawBoxThin(text);
x.drawBoxThick(text);
x.drawBoxDouble(text);
x.drawBoxThinCurve(text);
x.drawBoxHorizontalThinVerticalThick(text);
x.drawBoxHorizontalThickVerticalThin(text);
x.drawBoxHorizontalThinVerticalDouble(text);
x.drawBoxHorizontalDoubleVerticalThin(text);
x.drawBoxInnerDoubleOuterThin(text);
x.drawBoxInnerThinOuterDouble(text);
x.drawBoxInnerThinOuterThick(text);
x.drawBoxInnerThickOuterThin(text);
x.drawBoxInnerDoubleOuterThinCurve(text);
x.drawBoxInnerThickOuterThinCurve(text);
x.drawBoxVerticalBarPlusMinus(text);
x.drawBoxVerticalBarPlusMinusSlashes(text);
x.drawBoxVerticalBarPlusEquals(text);
x.drawBoxVerticalBarPlusEqualsSlashes(text);

Array

see Demo_Array

const x = require('@siakhooi/box-drawing');

const textInArray = [
  ['Cell 1-1', 'Cell 2-1'],
  ['Cell 1-2', 'Cell 2-2'],
];

x.drawBoxThin(textInArray);
x.drawBoxThick(textInArray);
x.drawBoxDouble(textInArray);
x.drawBoxThinCurve(textInArray);
x.drawBoxHorizontalThinVerticalThick(textInArray);
x.drawBoxHorizontalThickVerticalThin(textInArray);
x.drawBoxHorizontalThinVerticalDouble(textInArray);
x.drawBoxHorizontalDoubleVerticalThin(textInArray);
x.drawBoxInnerDoubleOuterThin(textInArray);
x.drawBoxInnerThinOuterDouble(textInArray);
x.drawBoxInnerThinOuterThick(textInArray);
x.drawBoxInnerThickOuterThin(textInArray);
x.drawBoxInnerDoubleOuterThinCurve(textInArray);
x.drawBoxInnerThickOuterThinCurve(textInArray);
x.drawBoxVerticalBarPlusMinus(textInArray);
x.drawBoxVerticalBarPlusMinusSlashes(textInArray);
x.drawBoxVerticalBarPlusEquals(textInArray);
x.drawBoxVerticalBarPlusEqualsSlashes(textInArray);

BoxDrawingBuilder

see Demo_Builder

  • Basic
    • setData(data)
    • setStyle(boxStyle)
    • drawBox()
  • Padding
    • padLeft(column, spaces)
    • padRight(column, spaces)
    • padLeftAll(spaces[])
    • padRightAll(spaces[])
    • pad(column, left_spaces, right_spaces)
    • setDefaultPadLeft(spaces)
    • setDefaultPadRight(spaces)
    • setDefaultPad(left_spaces, right_spaces)
  • Horizontal Alignment
    • align(column, horizontalAlignment)
    • alignLeft(columns[])
    • alignRight(columns[])
    • alignCenter(columns[])
    • setDefaultAlignment(horizontalAlignment)

Basic

const {BoxDrawingBuilder, THINCURVE} = require('@siakhooi/box-drawing');

const textInArray = [
  ['Cell 1-1', 'Cell 2-1'],
  ['Cell 1-2', 'Cell 2-2'],
];

new BoxDrawingBuilder().setData(textInArray).setStyle(THINCURVE).drawBox();

Padding

const {BoxDrawingBuilder, THINCURVE} = require('@siakhooi/box-drawing');

const textInArray = [
  ['Cell 1-1', 'Cell 2-1'],
  ['Cell 1-2', 'Cell 2-2'],
];

new BoxDrawingBuilder()
  .setData(textInArray)
  .setStyle(THINCURVE)
  .setDefaultPadLeft(1)
  .setDefaultPadRight(2)
  .padLeft(0, 5)
  .padRight(1, 2)
  .pad(3, 1, 2)
  .padLeftAll([1, 2, 3, 4, 5])
  .padRightAll([5, 4, 3, 2, 1])
  .drawBox();

Horizontal Alignment

const {
  BoxDrawingBuilder,
  THINCURVE,
  HorizontalAlignmentEnum,
} = require('@siakhooi/box-drawing');

const textInArray = [
  ['Cell 1-1', 'Cell 2-1'],
  ['Cell 1-2', 'Cell 2-2'],
];

new BoxDrawingBuilder()
  .setData(textInArray)
  .setStyle(THINCURVE)
  .align(0, HorizontalAlignmentEnum.LEFT)
  .align(1, HorizontalAlignmentEnum.RIGHT)
  .drawBox();

Sudoku Board

const x = require('@siakhooi/box-drawing');

const data = [
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
  ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
];
x.drawSudokuBoardThick(data);
x.drawSudokuBoardDouble(data);

Readme

Keywords

Package Sidebar

Install

npm i @siakhooi/box-drawing

Weekly Downloads

1

Version

1.5.5

License

MIT

Unpacked Size

47.2 kB

Total Files

19

Last publish

Collaborators

  • siakhooi