MCPcopy Create free account
hub / github.com/denoland/celld / normalizeEncoding

Function normalizeEncoding

crates/celld/js/node_stream.js:78–91  ·  view source on GitHub ↗
(enc)

Source from the content-addressed store, hash-verified

76 };
77 const kEmptyObject = Object.freeze({ __proto__: null });
78 const normalizeEncoding = (enc) => {
79 if (enc == null || enc === "utf8" || enc === "utf-8") return "utf8";
80 switch (String(enc).toLowerCase()) {
81 case "utf8": case "utf-8": return "utf8";
82 case "ucs2": case "ucs-2": case "utf16le": case "utf-16le":
83 return "utf16le";
84 case "latin1": case "binary": return "latin1";
85 case "base64": return "base64";
86 case "base64url": return "base64url";
87 case "hex": return "hex";
88 case "ascii": return "ascii";
89 default: return undefined;
90 }
91 };
92 const once = (callback) => {
93 let called = false;
94 return function (...args) {

Callers 2

constructorMethod · 0.85
validateEncodingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected