API reference
linegauge/cli-truncate
Every export of linegauge/cli-truncate, with its signature and doc comment: cliTruncate, plus 1 type.
import cliTruncate from 'linegauge/cli-truncate';
import type { Options } from 'linegauge/cli-truncate';Functions
default
The default export, declared as cliTruncate.
Truncate text to columns terminal columns, as cli-truncate does.
function cliTruncate(text: string, columns: number, options?: Options): string;| Parameter | Type |
|---|---|
text | string |
columns | number |
options (optional) | Options |
Returns string
Interfaces
Options
cli-truncate's options.
interface Options {
/** Which end loses characters. Default `'end'`. */
readonly position?: 'start' | 'middle' | 'end';
/** A space between the text and the mark. Default `false`. */
readonly space?: boolean;
/** Cut at a space within three columns of the break, when there is one. Default `false`. */
readonly preferTruncationOnSpace?: boolean;
/** The mark that says something was removed. Default `'…'`. */
readonly truncationCharacter?: string;
}