Skip to content

Commit

Permalink
chore(console): complete documentation (#3901)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Dec 6, 2023
1 parent 733b60e commit 6871f6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion console/unicode_width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 6871f6b

Please sign in to comment.