Skip to content

tree-shakable #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions browser-symbols.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const info = 'ℹ️';
export const success = '✅';
export const warning = '⚠️';
export const error = '❌️';
9 changes: 1 addition & 8 deletions browser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
const logSymbols = {
info: 'ℹ️',
success: '✅',
warning: '⚠️',
error: '❌️',
};

export default logSymbols;
export * as default from './browser-symbols.js';
21 changes: 1 addition & 20 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
import {blue, green, yellow, red} from 'yoctocolors';
import isUnicodeSupported from 'is-unicode-supported';

const main = {
info: blue('ℹ'),
success: green('✔'),
warning: yellow('⚠'),
error: red('✖'),
};

const fallback = {
info: blue('i'),
success: green('√'),
warning: yellow('‼'),
error: red('×'),
};

const logSymbols = isUnicodeSupported() ? main : fallback;

export default logSymbols;
export * as default from './symbols.js';
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"files": [
"index.js",
"index.d.ts",
"browser.js"
"browser.js",
"symbols.js",
"browser-symbols.js"
],
"keywords": [
"unicode",
Expand Down
9 changes: 9 additions & 0 deletions symbols.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {blue, green, yellow, red} from 'yoctocolors';
import isUnicodeSupported from 'is-unicode-supported';

const _isUnicodeSupported = isUnicodeSupported();

export const info = blue(_isUnicodeSupported ? 'ℹ' : 'i');
export const success = green(_isUnicodeSupported ? '✔' : '√');
export const warning = yellow(_isUnicodeSupported ? '⚠' : '‼');
export const error = red(_isUnicodeSupported ? '✖️' : '×');
Loading