MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / huffmanDecode

Method huffmanDecode

__test__/theorem.js:1422–1435  ·  view source on GitHub ↗
(bitstring, tree)

Source from the content-addressed store, hash-verified

1420 }
1421
1422 huffmanDecode(bitstring, tree) {
1423 const result = [];
1424 let node = tree;
1425
1426 for (const bit of [...bitstring]) {
1427 node = bit === "0" ? node.left : node.right;
1428 if (!node.left && !node.right) {
1429 result.push(node.key);
1430 node = tree;
1431 }
1432 }
1433
1434 return result.join("");
1435 }
1436 md5(s) {
1437 if (BigNumber.isBigNumber(s) || (!isNaN(parseFloat(s)) && isFinite(s))) {
1438 s = s.toString()

Callers 1

test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected