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

Function BOMSniffing

out/cli.cjs:61341–61351  ·  view source on GitHub ↗
(ioQueue)

Source from the content-addressed store, hash-verified

61339 let slice = 0;
61340 if (BOMEncoding !== null) {
61341 encoding = BOMEncoding;
61342 slice = BOMEncoding === "UTF-8" ? 3 : 2;
61343 }
61344 const sliced = bytes.slice(slice);
61345 return new TextDecoder(encoding).decode(sliced);
61346 }
61347 function BOMSniffing(ioQueue) {
61348 const [a4, b7, c4] = ioQueue;
61349 if (a4 === 239 && b7 === 187 && c4 === 191) {
61350 return "UTF-8";
61351 } else if (a4 === 254 && b7 === 255) {
61352 return "UTF-16BE";
61353 } else if (a4 === 255 && b7 === 254) {
61354 return "UTF-16LE";

Callers 1

decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…