UNPKG

@technobuddha/library

Version:
24 lines (23 loc) 759 B
declare type Options = { /** The width to wrap to */ width?: number; /** Line separator */ separator?: string; /** If true, don't limit breaks to word boundaries */ cut?: boolean; /** If true, spaces are added to the end of each line to make all lines equal width, ignored if cut or preserveSpaces is true */ trailingSpaces?: boolean; }; /** * Wrap text so that it fits within a area of fixed width * * @param input the text to wrap * @param options * @default width 75 * @default separator \n * @default cut default false * @default trailingSpaces false * @returns wrapped text */ export declare function wordwrap(input: string, { width, separator, cut, trailingSpaces }?: Options): string; export default wordwrap;