Last 12 weeks · 0 commits
4 of 6 standards met
Summary: This PR refactors the isUnicodeSupported function to improve its readability, efficiency, and platform compatibility checks. The updated code makes it easier to manage and extend terminal emulator checks, ensuring more accurate detection of Unicode support across different environments. Changes: Platform-Specific Checks: Simplified the logic for detecting Unicode support by handling non-Windows and Windows platforms separately. Windows Terminal Support: Grouped Windows terminal emulator checks into concise boolean expressions for clarity. Terminal List Refactoring: Used an array to store known terminal types, making it more maintainable when adding/removing terminal checks. Code Readability: Enhanced code readability with early returns, clear variable naming, and logical grouping of conditions. Why This Change: Improved Maintainability: The refactor allows for easier additions or modifications of supported terminal types in the future. Cleaner Logic: The separation of platform-specific checks ensures a more structured and efficient flow in the code. Cross-Platform Reliability: Enhances Unicode support detection on various environments, particularly for Windows-based terminal emulators. Testing: Verified functionality across multiple platforms (Windows, macOS, Linux) to ensure correct behavior. Ensured backwards compatibility with existing terminal environments.
Repository: sindresorhus/is-unicode-supported. Description: Detect whether the terminal supports Unicode Stars: 86, Forks: 9. Primary language: JavaScript. Languages: JavaScript (91.4%), TypeScript (8.6%). License: MIT. Latest release: v2.1.0 (1y ago). Open PRs: 0, open issues: 0. Last activity: 1y ago. Community health: 85%. Top contributors: sindresorhus, ehmicky, guilhermetod, mataha.