MCPcopy Create free account
hub / github.com/Effect-TS/effect / utf8Length

Function utf8Length

packages/effect/src/encoding/Xml.ts:2215–2215  ·  view source on GitHub ↗
(lead: number)

Source from the content-addressed store, hash-verified

2213}
2214
2215const utf8Length = (lead: number): number => lead >= 0xF0 ? 4 : lead >= 0xE0 ? 3 : lead >= 0xC0 ? 2 : 1
2216
2217// Returns the length of the valid UTF-8 prefix of `bytes`
2218const validUtf8 = (bytes: Uint8Array): number => {

Callers 2

validUtf8Function · 0.70
pushMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected