Interface StringWidthOptions

Options for creating a StringWidth instance.

interface StringWidthOptions {
    extraWidths: undefined | ExtraWidths;
    includeANSI: undefined | boolean;
    isCJK: undefined | boolean;
    locale: undefined | string;
}

Properties

extraWidths: undefined | ExtraWidths

A lookup map for code points whose width you would like to override. Might be a Map<number, number>, UnicodeTrie, or anything else that has a get(codePoint: number) => number method.

includeANSI: undefined | boolean

If true, include ANSI escape sequences in the width of the string. If false, strips ANSI before calculating width. defaults to false.

isCJK: undefined | boolean

If specified, override using the script of the locale to determine whether we are in a CJK context.

locale: undefined | string

The locale to use for grapheme segmentation and to determine if we are in a CJK context for code points that have ambiguous East Asian Width. Defaults to systems's locale.