Skip to main content

is_unicode_supported

GitMoji License: MIT Lines Of Code CodeQL Lint

You can get this package by nest.land, deno.land or denopkg.

Detect whether the terminal supports Unicode, port of is-unicode-supported.

This can be useful to decide whether to use Unicode characters or fallback ASCII characters in command-line output.

Note that the check is quite naive. It just assumes all non-Windows terminals support Unicode and hard-codes which Windows terminals that do support Unicode.

Usage

This package exposes two Functions, isUnicodeSupported and isUnicodeSupportedSync.

// @deno-types="https://deno.land/x/is_unicode_supported/mod.d.ts"
import isUnicodeSupported, {
    isUnicodeSupportedSync,
} from "https://deno.land/x/is_unicode_supported/mod.js";

const canIHaveEmojis = await isUnicodeSupported(); // isUnicodeSupported();

API

isUnicodeSupported()

Returns a Promize<boolean> for whether the terminal supports Unicode.

isUnicodeSupportedSync()

Returns a boolean for whether the terminal supports Unicode.

License

This project is licensed under the MIT License.