Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. 'use strict';
  2. const escapeStringRegexp = require('escape-string-regexp');
  3. const platform = process.platform;
  4. const main = {
  5. tick: '✔',
  6. cross: '✖',
  7. star: '★',
  8. square: '▇',
  9. squareSmall: '◻',
  10. squareSmallFilled: '◼',
  11. play: '▶',
  12. circle: '◯',
  13. circleFilled: '◉',
  14. circleDotted: '◌',
  15. circleDouble: '◎',
  16. circleCircle: 'ⓞ',
  17. circleCross: 'ⓧ',
  18. circlePipe: 'Ⓘ',
  19. circleQuestionMark: '?⃝',
  20. bullet: '●',
  21. dot: '․',
  22. line: '─',
  23. ellipsis: '…',
  24. pointer: '❯',
  25. pointerSmall: '›',
  26. info: 'ℹ',
  27. warning: '⚠',
  28. hamburger: '☰',
  29. smiley: '㋡',
  30. mustache: '෴',
  31. heart: '♥',
  32. arrowUp: '↑',
  33. arrowDown: '↓',
  34. arrowLeft: '←',
  35. arrowRight: '→',
  36. radioOn: '◉',
  37. radioOff: '◯',
  38. checkboxOn: '☒',
  39. checkboxOff: '☐',
  40. checkboxCircleOn: 'ⓧ',
  41. checkboxCircleOff: 'Ⓘ',
  42. questionMarkPrefix: '?⃝',
  43. oneHalf: '½',
  44. oneThird: '⅓',
  45. oneQuarter: '¼',
  46. oneFifth: '⅕',
  47. oneSixth: '⅙',
  48. oneSeventh: '⅐',
  49. oneEighth: '⅛',
  50. oneNinth: '⅑',
  51. oneTenth: '⅒',
  52. twoThirds: '⅔',
  53. twoFifths: '⅖',
  54. threeQuarters: '¾',
  55. threeFifths: '⅗',
  56. threeEighths: '⅜',
  57. fourFifths: '⅘',
  58. fiveSixths: '⅚',
  59. fiveEighths: '⅝',
  60. sevenEighths: '⅞'
  61. };
  62. const win = {
  63. tick: '√',
  64. cross: '×',
  65. star: '*',
  66. square: '█',
  67. squareSmall: '[ ]',
  68. squareSmallFilled: '[█]',
  69. play: '►',
  70. circle: '( )',
  71. circleFilled: '(*)',
  72. circleDotted: '( )',
  73. circleDouble: '( )',
  74. circleCircle: '(○)',
  75. circleCross: '(×)',
  76. circlePipe: '(│)',
  77. circleQuestionMark: '(?)',
  78. bullet: '*',
  79. dot: '.',
  80. line: '─',
  81. ellipsis: '...',
  82. pointer: '>',
  83. pointerSmall: '»',
  84. info: 'i',
  85. warning: '‼',
  86. hamburger: '≡',
  87. smiley: '☺',
  88. mustache: '┌─┐',
  89. heart: main.heart,
  90. arrowUp: main.arrowUp,
  91. arrowDown: main.arrowDown,
  92. arrowLeft: main.arrowLeft,
  93. arrowRight: main.arrowRight,
  94. radioOn: '(*)',
  95. radioOff: '( )',
  96. checkboxOn: '[×]',
  97. checkboxOff: '[ ]',
  98. checkboxCircleOn: '(×)',
  99. checkboxCircleOff: '( )',
  100. questionMarkPrefix: '?',
  101. oneHalf: '1/2',
  102. oneThird: '1/3',
  103. oneQuarter: '1/4',
  104. oneFifth: '1/5',
  105. oneSixth: '1/6',
  106. oneSeventh: '1/7',
  107. oneEighth: '1/8',
  108. oneNinth: '1/9',
  109. oneTenth: '1/10',
  110. twoThirds: '2/3',
  111. twoFifths: '2/5',
  112. threeQuarters: '3/4',
  113. threeFifths: '3/5',
  114. threeEighths: '3/8',
  115. fourFifths: '4/5',
  116. fiveSixths: '5/6',
  117. fiveEighths: '5/8',
  118. sevenEighths: '7/8'
  119. };
  120. if (platform === 'linux') {
  121. // the main one doesn't look that good on Ubuntu
  122. main.questionMarkPrefix = '?';
  123. }
  124. const figures = platform === 'win32' ? win : main;
  125. const fn = str => {
  126. if (figures === main) {
  127. return str;
  128. }
  129. Object.keys(main).forEach(key => {
  130. if (main[key] === figures[key]) {
  131. return;
  132. }
  133. str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]);
  134. });
  135. return str;
  136. };
  137. module.exports = Object.assign(fn, figures);