source: trip-planner-front/node_modules/figures/index.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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