MCPcopy Create free account
hub / github.com/denoland/std / unicodeWidth

Function unicodeWidth

cli/unicode_width.ts:77–79  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

75 * {@linkcode unicodeWidth}.
76 */
77export function unicodeWidth(str: string): number {
78 return [...str].map((ch) => charWidth(ch) ?? 0).reduce((a, b) => a + b, 0);
79}

Callers 2

fnFunction · 0.90

Calls 1

charWidthFunction · 0.85

Tested by

no test coverage detected