MCPcopy Create free account
hub / github.com/Snapchat/Valdi / encodeString

Function encodeString

src/valdi_modules/src/valdi/coreutils/web/UnicodeNative.ts:32–39  ·  view source on GitHub ↗
(str: string, encoding: Encoding)

Source from the content-addressed store, hash-verified

30 case Encoding.utf8:
31 return encodeUtf8(str).buffer;
32 case Encoding.utf16:
33 return encodeUtf16LE(str).buffer; // no BOM
34 case Encoding.utf32:
35 return encodeUtf32LE(str).buffer; // no BOM
36 default:
37 throw new TypeError('Unknown encoding');
38 }
39}
40
41export function decodeIntoString(buffer: ArrayBufferLike, encoding: Encoding): string {
42 switch (encoding) {

Callers 1

encodeMethod · 0.90

Calls 3

encodeUtf8Function · 0.85
encodeUtf32LEFunction · 0.85
encodeUtf16LEFunction · 0.70

Tested by

no test coverage detected