diff --git a/browser-symbols.js b/browser-symbols.js new file mode 100644 index 0000000..d93c688 --- /dev/null +++ b/browser-symbols.js @@ -0,0 +1,4 @@ +export const info = 'ℹ️'; +export const success = '✅'; +export const warning = '⚠️'; +export const error = '❌️'; diff --git a/browser.js b/browser.js index 9bcecee..ffca914 100644 --- a/browser.js +++ b/browser.js @@ -1,8 +1 @@ -const logSymbols = { - info: 'ℹ️', - success: '✅', - warning: '⚠️', - error: '❌️', -}; - -export default logSymbols; +export * as default from './browser-symbols.js'; diff --git a/index.js b/index.js index 6f7aaf9..24d3f36 100644 --- a/index.js +++ b/index.js @@ -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'; diff --git a/package.json b/package.json index 199b052..fa32c5b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "files": [ "index.js", "index.d.ts", - "browser.js" + "browser.js", + "symbols.js", + "browser-symbols.js" ], "keywords": [ "unicode", diff --git a/symbols.js b/symbols.js new file mode 100644 index 0000000..e92266e --- /dev/null +++ b/symbols.js @@ -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 ? '✖️' : '×');