MCPcopy
hub / github.com/di-sukharev/opencommit / getDecoder

Function getDecoder

out/cli.cjs:48742–48778  ·  view source on GitHub ↗
(charset)

Source from the content-addressed store, hash-verified

48740 ["utf8", utf8Decoder]
48741 ]);
48742 function getDecoder(charset) {
48743 let lc;
48744 while (true) {
48745 switch (charset) {
48746 case "utf-8":
48747 case "utf8":
48748 return decoders.utf8;
48749 case "latin1":
48750 case "ascii":
48751 // TODO: Make these a separate, strict decoder?
48752 case "us-ascii":
48753 case "iso-8859-1":
48754 case "iso8859-1":
48755 case "iso88591":
48756 case "iso_8859-1":
48757 case "windows-1252":
48758 case "iso_8859-1:1987":
48759 case "cp1252":
48760 case "x-cp1252":
48761 return decoders.latin1;
48762 case "utf16le":
48763 case "utf-16le":
48764 case "ucs2":
48765 case "ucs-2":
48766 return decoders.utf16le;
48767 case "base64":
48768 return decoders.base64;
48769 default:
48770 if (lc === void 0) {
48771 lc = true;
48772 charset = charset.toLowerCase();
48773 continue;
48774 }
48775 return decoders.other.bind(charset);
48776 }
48777 }
48778 }
48779 var decoders = {
48780 utf8: (data, sourceEncoding) => {
48781 if (data.length === 0) {

Callers 1

decodeTextFunction · 0.85

Calls 1

toLowerCaseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…