MCPcopy Create free account
hub / github.com/cheeaun/phanpy / stringLength

Function stringLength

src/utils/string-length.js:3–10  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

1const segmenter = new Intl.Segmenter();
2
3export default function stringLength(string) {
4 if (string === '') return 0;
5 let length = 0;
6 for (const _ of segmenter.segment(string)) {
7 length++;
8 }
9 return length;
10}

Callers 1

getCharCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected