UNPKG

text-aligner

Version:

Align text by adding spaces to each string so that all strings have the same number of English and Chinese characters.

16 lines (14 loc) 693 B
declare const FallbackKey: "@@fallback"; type PaddingRule = { test: RegExp | ((char: string) => boolean) | typeof FallbackKey; placeholder: string; }; /** * Aligns an array of strings by adding spaces to each string so that all strings have the same number of English and Chinese characters. * * @param {string[]} strings - An array of strings to be aligned. * @param {Record<string, PaddingRule | string>} paddingMap - A map of padding rules for different character types. * @returns {string[]} - An array of aligned strings with added spaces. */ declare function alignText(strings: string[], paddingMap?: Record<string, PaddingRule | string>): string[]; export { alignText };