Skip to content

Commit

Permalink
Small refactoring (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Oct 29, 2023
1 parent d14b76e commit b10ba98
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ const common = {
lineSlash: '╱',
};

export const mainSymbols = {
...common,
const specialMainSymbols = {
tick: '✔',
info: 'ℹ',
warning: '⚠',
Expand Down Expand Up @@ -235,8 +234,7 @@ export const mainSymbols = {
oneTenth: '⅒',
};

export const fallbackSymbols = {
...common,
const specialFallbackSymbols = {
tick: '√',
info: 'i',
warning: '‼',
Expand Down Expand Up @@ -273,12 +271,14 @@ export const fallbackSymbols = {
oneTenth: '1/10',
};

export const mainSymbols = {...common, ...specialMainSymbols};
export const fallbackSymbols = {...common, ...specialFallbackSymbols};

const shouldUseMain = isUnicodeSupported();
const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
export default figures;

const replacements = Object.entries(mainSymbols)
.filter(([key, mainSymbol]) => fallbackSymbols[key] !== mainSymbol);
const replacements = Object.entries(specialMainSymbols);

// On terminals which do not support Unicode symbols, substitute them to other symbols
export const replaceSymbols = string => {
Expand Down

0 comments on commit b10ba98

Please sign in to comment.