Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

drawBorder.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0;
  6. /**
  7. * @typedef drawBorder~parts
  8. * @property {string} left
  9. * @property {string} right
  10. * @property {string} body
  11. * @property {string} join
  12. */
  13. /**
  14. * @param {number[]} columnSizeIndex
  15. * @param {drawBorder~parts} parts
  16. * @returns {string}
  17. */
  18. const drawBorder = (columnSizeIndex, parts) => {
  19. const columns = columnSizeIndex.map(size => {
  20. return parts.body.repeat(size);
  21. }).join(parts.join);
  22. return parts.left + columns + parts.right + '\n';
  23. };
  24. /**
  25. * @typedef drawBorderTop~parts
  26. * @property {string} topLeft
  27. * @property {string} topRight
  28. * @property {string} topBody
  29. * @property {string} topJoin
  30. */
  31. /**
  32. * @param {number[]} columnSizeIndex
  33. * @param {drawBorderTop~parts} parts
  34. * @returns {string}
  35. */
  36. exports.drawBorder = drawBorder;
  37. const drawBorderTop = (columnSizeIndex, parts) => {
  38. return drawBorder(columnSizeIndex, {
  39. body: parts.topBody,
  40. join: parts.topJoin,
  41. left: parts.topLeft,
  42. right: parts.topRight
  43. });
  44. };
  45. /**
  46. * @typedef drawBorderJoin~parts
  47. * @property {string} joinLeft
  48. * @property {string} joinRight
  49. * @property {string} joinBody
  50. * @property {string} joinJoin
  51. */
  52. /**
  53. * @param {number[]} columnSizeIndex
  54. * @param {drawBorderJoin~parts} parts
  55. * @returns {string}
  56. */
  57. exports.drawBorderTop = drawBorderTop;
  58. const drawBorderJoin = (columnSizeIndex, parts) => {
  59. return drawBorder(columnSizeIndex, {
  60. body: parts.joinBody,
  61. join: parts.joinJoin,
  62. left: parts.joinLeft,
  63. right: parts.joinRight
  64. });
  65. };
  66. /**
  67. * @typedef drawBorderBottom~parts
  68. * @property {string} topLeft
  69. * @property {string} topRight
  70. * @property {string} topBody
  71. * @property {string} topJoin
  72. */
  73. /**
  74. * @param {number[]} columnSizeIndex
  75. * @param {drawBorderBottom~parts} parts
  76. * @returns {string}
  77. */
  78. exports.drawBorderJoin = drawBorderJoin;
  79. const drawBorderBottom = (columnSizeIndex, parts) => {
  80. return drawBorder(columnSizeIndex, {
  81. body: parts.bottomBody,
  82. join: parts.bottomJoin,
  83. left: parts.bottomLeft,
  84. right: parts.bottomRight
  85. });
  86. };
  87. exports.drawBorderBottom = drawBorderBottom;
  88. //# sourceMappingURL=drawBorder.js.map