function plainLength
plainLength(text: string): number

Width as the terminal sees it — colour codes take columns nowhere but in the string.

import { plainLength } from './terminal.ts';

plainLength('hi'); // 2
plainLength(`${String.fromCharCode(27)}[33mhi${String.fromCharCode(27)}[0m`); // 2 — colour is free

Parameters

text: string

Return Type

number

Usage

import { plainLength } from "lib/repl/terminal.ts";