Skip to content

flex-development/is-unicode-supported

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

👍 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

  • browser friendly
  • no dependencies
  • typescript support

Install

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>

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.

Sponsor this project

 

Packages

 
 
 

Contributors 3

  •  
  •  
  •