UNPKG

ptt-client

Version:

A Node client for fetching data from ptt.cc.

25 lines (24 loc) 1.19 kB
export declare function dbcswidth(str: string): number; /** * calculate width of string. * @params {string} widthType - calculate width by wcwidth or String.length * @params {string} str - string to calculate */ export declare function getWidth(widthType: string, str: string): number; /** * calculate the position that the prefix of string is a specific width * @params {string} widthType - calculate width by wcwidth or String.length * @params {string} str - string to calculate * @params {number} width - the width of target string */ export declare function indexOfWidth(widthType: string, str: string, width?: number): number; /** * extract parts of string, beginning at the character at the specified position, * and returns the specified width of characters. if the character is incomplete, * it will be replaced by space. * @params {string} widthType - calculate width by wcwidth or String.length * @params {string} str - string to calculate * @params {number} startWidth - the beginning position of string * @params {number} width - the width of target string */ export declare function substrWidth(widthType: string, str: string, startWidth: number, width?: number): string;