1.0.1 • Published 5 months ago

@flex-development/is-unicode-supported v1.0.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
5 months ago

\:thumbsup: is-unicode-supported

github release npm codecov module type: esm license conventional commits typescript vitest yarn

check whether unicode is supported in the terminal and browser

Contents

What is this?

This is a small, but useful, library for detecting unicode support in the terminal and browser consoles.

Features

Install

This package is ESM only.

In Node.js with yarn:

yarn add @flex-development/is-unicode-supported

In Deno with esm.sh:

import { isUnicodeSupported } from 'https://esm.sh/@flex-development/is-unicode-supported'

In browsers with esm.sh:

<script type="module">
  import { isUnicodeSupported } from 'https://esm.sh/@flex-development/is-unicode-supported'
</script>

Use

import isUnicodeSupported from '@flex-development/is-unicode-supported'

console.log(isUnicodeSupported())

API

This package exports the identifier isUnicodeSupported.

The default export is also isUnicodeSupported.

isUnicodeSupported()

Check if Unicode is supported.

This can be useful to decide whether to use Unicode characters or fallback ASCII characters.

👉 Note: The function assumes all non-Windows terminals support Unicode and browsers that can correctly render '✓' (U+2713) also support unicode. Windows terminals with unicode support are checked against a hardcoded list.

Returns

(boolean) true if unicode is supported, false otherwise

Types

This package is fully typed with TypeScript.

Contribute

See CONTRIBUTING.md.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.