From a11d76a7aff45097f54c8ff428f2c3e6019adcad Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Tue, 13 Aug 2024 10:43:53 +0100 Subject: [PATCH] cache `isUnicodeSupported` result --- symbols.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/symbols.js b/symbols.js index dcf90a5..0cc27c0 100644 --- a/symbols.js +++ b/symbols.js @@ -1,9 +1,11 @@ import {blue, green, yellow, red} from 'yoctocolors'; import isUnicodeSupported from 'is-unicode-supported'; -const info = blue(isUnicodeSupported() ? 'ℹ' : 'i'); -const success = green(isUnicodeSupported() ? '✔' : '√'); -const warning = yellow(isUnicodeSupported() ? '⚠' : '‼'); -const error = red(isUnicodeSupported() ? '✖️' : '×'); +const _isUnicodeSupported = isUnicodeSupported(); + +const info = blue(_isUnicodeSupported ? 'ℹ' : 'i'); +const success = green(_isUnicodeSupported ? '✔' : '√'); +const warning = yellow(_isUnicodeSupported ? '⚠' : '‼'); +const error = red(_isUnicodeSupported ? '✖️' : '×'); export {info, success, warning, error};