MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getEncoding

Function getEncoding

src/utils/encodings.js:18–41  ·  view source on GitHub ↗
(charset)

Source from the content-addressed store, hash-verified

16 * @returns {Encoding|undefined}
17 */
18export function getEncoding(charset) {
19 charset = charset.toLowerCase();
20
21 const found = Object.keys(encodings).find((key) => {
22 if (key.toLowerCase() === charset) {
23 return true;
24 }
25
26 const alias = encodings[key].aliases.find(
27 (alias) => alias.toLowerCase() === charset,
28 );
29 if (alias) {
30 return true;
31 }
32
33 return false;
34 });
35
36 if (found) {
37 return encodings[found];
38 }
39
40 return encodings["UTF-8"];
41}
42
43function detectBOM(bytes) {
44 if (

Callers 4

main.jsFile · 0.90
otherSettingsFunction · 0.90
detectEncodingFunction · 0.85
getEncodingNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected