@nightgrey/ansi
    Preparing search index...

    Function stringWidth

    • Returns the width of a string in cells. This is the number of cells that the string will occupy when printed in a terminal. ANSI escape codes are ignored and wide characters (such as east asian characters & emojis) are accounted for.

      Parameters

      • string: string
      • Optionaloptions: WidthOptions

      Returns number

      import { stringWidth } from './width';

      width('a');
      //=> 1

      width('古');
      //=> 2

      width('\u001B[1m古\u001B[22m');
      //=> 2