Show HN: uWrap.js – A faster and more accurate text wrapping util in < 2KB
a year ago
- #performance
- #text-wrapping
- #UI-optimization
- uWrap is a fast and accurate text wrapping utility for UI performance optimization in large, scrollable datasets.
- It outperforms canvas-hypertxt in CPU and memory usage while being more accurate.
- Currently works best with Latin charsets and supports the pre-line wrapping strategy.
- Does not handle Windows-style \r\n line breaks yet.
- Benchmarks show significant performance improvements over canvas-hypertxt across browsers.
- Easy to install via npm or script tag, with a simple TypeScript definition.
- Provides utility functions for counting lines, testing if text will wrap, and splitting text into lines.