MCPcopy Create free account
hub / github.com/abue-ammar/tinycast / normalizeEncoding

Function normalizeEncoding

Scripts/raycast-runtime/src/buffer.js:31–39  ·  view source on GitHub ↗
(encoding)

Source from the content-addressed store, hash-verified

29}
30
31function normalizeEncoding(encoding) {
32 const name = String(encoding || "utf8").toLowerCase();
33 if (name === "utf-8" || name === "utf8") return "utf8";
34 if (name === "base64" || name === "base64url") return name;
35 if (name === "hex") return "hex";
36 if (name === "latin1" || name === "binary" || name === "ascii") return "latin1";
37 if (name === "utf16le" || name === "ucs2" || name === "ucs-2" || name === "utf-16le") return "utf16le";
38 return "utf8";
39}
40
41function decode(bytes, encoding) {
42 switch (normalizeEncoding(encoding)) {

Callers 2

decodeFunction · 0.85
encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected