Impure version of format which changes depending on the current NodeJS
globalThis.process environment.
Example
// In a environment with color: optionalFormat(42)(13)("Vangware"); // "\x1b[42mVangware\x1b[13m" // In an environment without color: optionalFormat(42)(13)("Vangware"); // "Vangware" // It also works with tagged templates: optionalFormat(42)(13)`Vangware`; // "\x1b[42mVangware\x1b[13m"
Returns
Either the formatted string, or just the passed string.
Impure version of
format
which changes depending on the current NodeJSglobalThis.process
environment.Example
Returns
Either the formatted string, or just the passed string.