Get the column count of a string as it would be displayed in a terminal. Supports ANSI escape codes, emoji, and wide characters.
This is useful for:
- Aligning text in a terminal
- Quickly checking if a string contains ANSI escape codes
- Measuring the width of a string in a terminal
This API is designed to match the popular "string-width" package, so that existing code can be easily ported to Bun and vice versa.