# linegauge/v8

> Every export of linegauge/v8, with its signature and doc comment: lineCount, measure, width, width, plus 2 types.

Source: https://linegauge.interlace.tools/docs/api/v8

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

`linegauge/v8` — string-width 8.3.0's drop-in, for a project pinned to `string-width@8`.

```ts
import width from 'linegauge/v8';
import { lineCount, measure, width } from 'linegauge/v8';
```

## Functions

### default

The default export, declared as `width`.

How many terminal columns `input` occupies once its escape sequences are removed.

```ts
function width(input: string, options?: WidthOptions): number;
```

| Parameter | Type |
| :-- | :-- |
| `input` | `string` |
| `options` (optional) | `WidthOptions` |

**Returns** `number`

### lineCount

Lines a string occupies in a terminal `columns` wide — the measurement the frame loop
actually asks for. An empty line still occupies one.

```ts
function lineCount(text: string, columns: number): number;
```

| Parameter | Type |
| :-- | :-- |
| `text` | `string` |
| `columns` | `number` |

**Returns** `number`

### measure

Columns a string of *plain* text occupies — no escape scan. The wrapper below has
already split its input into text runs and complete sequences, so rescanning would only
give a malformed sequence a second chance to be mistaken for one.

```ts
function measure(text: string, ambiguousIsWide?: boolean): number;
```

| Parameter | Type |
| :-- | :-- |
| `text` | `string` |
| `ambiguousIsWide` (optional) | `boolean` |

**Returns** `number`

### width

How many terminal columns `input` occupies once its escape sequences are removed.

```ts
function width(input: string, options?: WidthOptions): number;
```

| Parameter | Type |
| :-- | :-- |
| `input` | `string` |
| `options` (optional) | `WidthOptions` |

**Returns** `number`

## Interfaces

### Options

What `width` accepts beyond the string. Graded against `string-width`'s own suite, so the
names and the defaults are its names and its defaults, not ours.

```ts
interface WidthOptions {
    /**
     * Treat East Asian Ambiguous characters as one column. **Default `true`** — the incumbent's
     * default, and right for a Latin terminal: `±`, `×`, `÷`, the box-drawing set, Greek and
     * Cyrillic all occupy one column there.
     */
    ambiguousIsNarrow?: boolean;
    /**
     * Count escape sequences as the characters they are made of instead of removing them.
     */
    countAnsiEscapeCodes?: boolean;
}
```

### WidthOptions

What `width` accepts beyond the string. Graded against `string-width`'s own suite, so the
names and the defaults are its names and its defaults, not ours.

```ts
interface WidthOptions {
    /**
     * Treat East Asian Ambiguous characters as one column. **Default `true`** — the incumbent's
     * default, and right for a Latin terminal: `±`, `×`, `÷`, the box-drawing set, Greek and
     * Cyrillic all occupy one column there.
     */
    ambiguousIsNarrow?: boolean;
    /**
     * Count escape sequences as the characters they are made of instead of removing them.
     */
    countAnsiEscapeCodes?: boolean;
}
```
