Last 12 weeks · 2 commits
4 of 6 standards met
#14 and https://github.com/sindresorhus/get-east-asian-width/commit/8a1a5efca8c2645c2f8f94f2572461007a3bca2d makes bundler unable to tree-shake unused ranges. This increases the Prettier package ~29kb. Let's simply save the minimal/maximum code point in lookup-data.js? For , we can also save in lookup-data.js, but Prettier need them anyway, I added a notation, so users that don't need them should be able to remove it too.
Problem The independent lookup functions in use long boolean chains (179 and 136 conditions for and respectively), which produce a large minified output and require O(n) linear scans. Changes Update to generate flat pair arrays with a shared binary search function for all independent lookup functions Add tests for all 6 East Asian Width categories Bundle size Minified: 5,582 → 4,170 bytes (-25%) Performance O(n) boolean chains → O(log n) binary search. Benchmarked with 10M iterations per test: Ref: https://github.com/sindresorhus/string-width/issues/71
Repository: sindresorhus/get-east-asian-width. Description: Determine the East Asian Width of a Unicode character Stars: 49, Forks: 9. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v1.6.0 (1mo ago). Open PRs: 0, open issues: 0. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, fisker, privatenumber, github-actions[bot].