check whether unicode is supported in the terminal and browser
This is a small, but useful, library for detecting unicode support in the terminal and browser consoles.
- browser friendly
- no dependencies
- typescript support
This package is ESM only.
In Node.js with yarn:
yarn add @flex-development/is-unicode-supported
See Git - Protocols | Yarn for details regarding installing from Git.
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>
import isUnicodeSupported from '@flex-development/is-unicode-supported'
console.log(isUnicodeSupported())
This package exports the identifier isUnicodeSupported
.
The default export is also 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.
(boolean
) true
if unicode is supported, false
otherwise
This package is fully typed with TypeScript.
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.