UNPKG

wcwidth-o1

Version:

glibc wcwidth/wcswidth for Node.js & TypeScript.

23 lines (22 loc) 819 B
/** * Determine number of column positions required for CH. * * - Accepts a single Unicode character as input. * * @param char A single Unicode character. * @returns Width of the character: 0, 1, 2, or -1 if not printable. */ export declare function wcwidth(char: string): number; /** * Determine number of column positions required for first N wide characters * (or fewer if S ends before this) in S. * * - Stops early and returns -1 if any character is non-printable. * - If `n` is given, only the first `n` characters are considered. * * @param str Input string to measure. * @param n Optional maximum number of characters to process. * @returns Total display width or -1 if any character is unprintable. */ export declare function wcswidth(str: string, n?: number): number; export default wcwidth;