Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | # is-unicode-supported
|
---|
| 2 |
|
---|
| 3 | > Detect whether the terminal supports Unicode
|
---|
| 4 |
|
---|
| 5 | This can be useful to decide whether to use Unicode characters or fallback ASCII characters in command-line output.
|
---|
| 6 |
|
---|
| 7 | 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. However, I have been using this logic in some popular packages for years without problems.
|
---|
| 8 |
|
---|
| 9 | ## Install
|
---|
| 10 |
|
---|
| 11 | ```
|
---|
| 12 | $ npm install is-unicode-supported
|
---|
| 13 | ```
|
---|
| 14 |
|
---|
| 15 | ## Usage
|
---|
| 16 |
|
---|
| 17 | ```js
|
---|
| 18 | const isUnicodeSupported = require('is-unicode-supported');
|
---|
| 19 |
|
---|
| 20 | isUnicodeSupported();
|
---|
| 21 | //=> true
|
---|
| 22 | ```
|
---|
| 23 |
|
---|
| 24 | ## API
|
---|
| 25 |
|
---|
| 26 | ### isUnicodeSupported()
|
---|
| 27 |
|
---|
| 28 | Returns a `boolean` for whether the terminal supports Unicode.
|
---|
| 29 |
|
---|
| 30 | ## Related
|
---|
| 31 |
|
---|
| 32 | - [is-interactive](https://github.com/sindresorhus/is-interactive) - Check if stdout or stderr is interactive
|
---|
| 33 | - [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
---|
| 34 | - [figures](https://github.com/sindresorhus/figures) - Unicode symbols with Windows fallbacks
|
---|
| 35 | - [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels
|
---|
Note:
See
TracBrowser
for help on using the repository browser.