chore(console): complete documentation (#3901)

This commit is contained in:
Asher Gomez 2023-12-06 18:16:11 +11:00 committed by GitHub
parent 733b60e4b2
commit 6871f6bbc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,6 @@ function charWidth(ch: string) {
* assertEquals(unicodeWidth(stripAnsiCode("\x1B]8;;https://deno.land\x07🦕\x1B]8;;\x07")), 2);
* ```
*/
export function unicodeWidth(str: string) {
export function unicodeWidth(str: string): number {
return [...str].map((ch) => charWidth(ch) ?? 0).reduce((a, b) => a + b, 0);
}