interface

StringWidthOptions

interface StringWidthOptions

  • ambiguousIsNarrow?: boolean

    If true, count ambiguous-width characters as 1 character wide. If false, count them as 2 characters wide.

  • countAnsiEscapeCodes?: boolean

    If true, count ANSI escape codes as part of the string width. If false, ignore them.

  • perCodePoint?: boolean

    If true, measure every Unicode code point individually (East Asian Width plus emoji presentation, the algorithm Node.js uses for console.table and util.inspect alignment), so each member of an emoji ZWJ sequence is counted: "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦" measures 8. If false, emoji sequences and other grapheme clusters count once: "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦" measures 2.