2022-01-21 08:28:41 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
const escapeStringRegexp = require('escape-string-regexp');
|
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
const {platform} = process;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
|
|
|
|
|
const main = {
|
|
|
|
|
tick: '✔',
|
|
|
|
|
cross: '✖',
|
|
|
|
|
star: '★',
|
|
|
|
|
square: '▇',
|
|
|
|
|
squareSmall: '◻',
|
|
|
|
|
squareSmallFilled: '◼',
|
|
|
|
|
play: '▶',
|
|
|
|
|
circle: '◯',
|
|
|
|
|
circleFilled: '◉',
|
|
|
|
|
circleDotted: '◌',
|
|
|
|
|
circleDouble: '◎',
|
|
|
|
|
circleCircle: 'ⓞ',
|
|
|
|
|
circleCross: 'ⓧ',
|
|
|
|
|
circlePipe: 'Ⓘ',
|
|
|
|
|
circleQuestionMark: '?⃝',
|
|
|
|
|
bullet: '●',
|
|
|
|
|
dot: '․',
|
|
|
|
|
line: '─',
|
|
|
|
|
ellipsis: '…',
|
|
|
|
|
pointer: '❯',
|
|
|
|
|
pointerSmall: '›',
|
|
|
|
|
info: 'ℹ',
|
|
|
|
|
warning: '⚠',
|
|
|
|
|
hamburger: '☰',
|
|
|
|
|
smiley: '㋡',
|
|
|
|
|
mustache: '෴',
|
|
|
|
|
heart: '♥',
|
2022-04-07 07:06:43 +00:00
|
|
|
|
nodejs: '⬢',
|
2022-01-21 08:28:41 +00:00
|
|
|
|
arrowUp: '↑',
|
|
|
|
|
arrowDown: '↓',
|
|
|
|
|
arrowLeft: '←',
|
|
|
|
|
arrowRight: '→',
|
|
|
|
|
radioOn: '◉',
|
|
|
|
|
radioOff: '◯',
|
|
|
|
|
checkboxOn: '☒',
|
|
|
|
|
checkboxOff: '☐',
|
|
|
|
|
checkboxCircleOn: 'ⓧ',
|
|
|
|
|
checkboxCircleOff: 'Ⓘ',
|
|
|
|
|
questionMarkPrefix: '?⃝',
|
|
|
|
|
oneHalf: '½',
|
|
|
|
|
oneThird: '⅓',
|
|
|
|
|
oneQuarter: '¼',
|
|
|
|
|
oneFifth: '⅕',
|
|
|
|
|
oneSixth: '⅙',
|
|
|
|
|
oneSeventh: '⅐',
|
|
|
|
|
oneEighth: '⅛',
|
|
|
|
|
oneNinth: '⅑',
|
|
|
|
|
oneTenth: '⅒',
|
|
|
|
|
twoThirds: '⅔',
|
|
|
|
|
twoFifths: '⅖',
|
|
|
|
|
threeQuarters: '¾',
|
|
|
|
|
threeFifths: '⅗',
|
|
|
|
|
threeEighths: '⅜',
|
|
|
|
|
fourFifths: '⅘',
|
|
|
|
|
fiveSixths: '⅚',
|
|
|
|
|
fiveEighths: '⅝',
|
|
|
|
|
sevenEighths: '⅞'
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
const windows = {
|
2022-01-21 08:28:41 +00:00
|
|
|
|
tick: '√',
|
|
|
|
|
cross: '×',
|
|
|
|
|
star: '*',
|
|
|
|
|
square: '█',
|
|
|
|
|
squareSmall: '[ ]',
|
|
|
|
|
squareSmallFilled: '[█]',
|
|
|
|
|
play: '►',
|
|
|
|
|
circle: '( )',
|
|
|
|
|
circleFilled: '(*)',
|
|
|
|
|
circleDotted: '( )',
|
|
|
|
|
circleDouble: '( )',
|
|
|
|
|
circleCircle: '(○)',
|
|
|
|
|
circleCross: '(×)',
|
|
|
|
|
circlePipe: '(│)',
|
|
|
|
|
circleQuestionMark: '(?)',
|
|
|
|
|
bullet: '*',
|
|
|
|
|
dot: '.',
|
|
|
|
|
line: '─',
|
|
|
|
|
ellipsis: '...',
|
|
|
|
|
pointer: '>',
|
|
|
|
|
pointerSmall: '»',
|
|
|
|
|
info: 'i',
|
|
|
|
|
warning: '‼',
|
|
|
|
|
hamburger: '≡',
|
|
|
|
|
smiley: '☺',
|
|
|
|
|
mustache: '┌─┐',
|
|
|
|
|
heart: main.heart,
|
2022-04-07 07:06:43 +00:00
|
|
|
|
nodejs: '♦',
|
2022-01-21 08:28:41 +00:00
|
|
|
|
arrowUp: main.arrowUp,
|
|
|
|
|
arrowDown: main.arrowDown,
|
|
|
|
|
arrowLeft: main.arrowLeft,
|
|
|
|
|
arrowRight: main.arrowRight,
|
|
|
|
|
radioOn: '(*)',
|
|
|
|
|
radioOff: '( )',
|
|
|
|
|
checkboxOn: '[×]',
|
|
|
|
|
checkboxOff: '[ ]',
|
|
|
|
|
checkboxCircleOn: '(×)',
|
|
|
|
|
checkboxCircleOff: '( )',
|
|
|
|
|
questionMarkPrefix: '?',
|
|
|
|
|
oneHalf: '1/2',
|
|
|
|
|
oneThird: '1/3',
|
|
|
|
|
oneQuarter: '1/4',
|
|
|
|
|
oneFifth: '1/5',
|
|
|
|
|
oneSixth: '1/6',
|
|
|
|
|
oneSeventh: '1/7',
|
|
|
|
|
oneEighth: '1/8',
|
|
|
|
|
oneNinth: '1/9',
|
|
|
|
|
oneTenth: '1/10',
|
|
|
|
|
twoThirds: '2/3',
|
|
|
|
|
twoFifths: '2/5',
|
|
|
|
|
threeQuarters: '3/4',
|
|
|
|
|
threeFifths: '3/5',
|
|
|
|
|
threeEighths: '3/8',
|
|
|
|
|
fourFifths: '4/5',
|
|
|
|
|
fiveSixths: '5/6',
|
|
|
|
|
fiveEighths: '5/8',
|
|
|
|
|
sevenEighths: '7/8'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (platform === 'linux') {
|
2022-04-07 07:06:43 +00:00
|
|
|
|
// The main one doesn't look that good on Ubuntu.
|
2022-01-21 08:28:41 +00:00
|
|
|
|
main.questionMarkPrefix = '?';
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
const figures = platform === 'win32' ? windows : main;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
const fn = string => {
|
2022-01-21 08:28:41 +00:00
|
|
|
|
if (figures === main) {
|
2022-04-07 07:06:43 +00:00
|
|
|
|
return string;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
for (const [key, value] of Object.entries(main)) {
|
|
|
|
|
if (value === figures[key]) {
|
|
|
|
|
continue;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
string = string.replace(new RegExp(escapeStringRegexp(value), 'g'), figures[key]);
|
|
|
|
|
}
|
2022-01-21 08:28:41 +00:00
|
|
|
|
|
2022-04-07 07:06:43 +00:00
|
|
|
|
return string;
|
2022-01-21 08:28:41 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = Object.assign(fn, figures);
|
2022-04-07 07:06:43 +00:00
|
|
|
|
module.exports.main = main;
|
|
|
|
|
module.exports.windows = windows;
|