Skip to content

Commit

Permalink
Simplify findLongestZeroSequence a bit
Browse files Browse the repository at this point in the history
Code cleanup only; no behavior changes.
  • Loading branch information
annevk authored May 11, 2020
1 parent 1e9fe49 commit cff2904
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ function parseIPv6(input) {

function serializeIPv6(address) {
let output = "";
const seqResult = findLongestZeroSequence(address);
const compress = seqResult.idx;
const compress = findLongestZeroSequence(address);
let ignore0 = false;

for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) {
Expand Down Expand Up @@ -434,14 +433,10 @@ function findLongestZeroSequence(arr) {

// if trailing zeros
if (currLen > maxLen) {
maxIdx = currStart;
maxLen = currLen;
return currStart;
}

return {
idx: maxIdx,
len: maxLen
};
return maxIdx;
}

function serializeHost(host) {
Expand Down

0 comments on commit cff2904

Please sign in to comment.