Skip to main content

calculateWidth

Callable

  • calculateWidth(text: string): number

  • Calculate and return the visual width of a string (number of terminal columns required). Based on string-width.

    import { calculateWidth } from '@boost/terminal';

    calculateWidth('古'); // 2