code format stdlize
This commit is contained in:
parent
567224ca60
commit
b3383680f9
|
|
@ -156,19 +156,19 @@ function _ipv4_to_string(v4Bytes) {
|
||||||
// ipv6 bytes to string
|
// ipv6 bytes to string
|
||||||
function _ipv6_to_string(v6Bytes, compress) {
|
function _ipv6_to_string(v6Bytes, compress) {
|
||||||
let ps = [], needCompress = false;
|
let ps = [], needCompress = false;
|
||||||
let last_hex = -1, hex = 0;
|
let lastHex = -1, hex = 0;
|
||||||
for (var i = 0; i < v6Bytes.length; i += 2) {
|
for (var i = 0; i < v6Bytes.length; i += 2) {
|
||||||
hex = v6Bytes.readUint16BE(i).toString(16);
|
hex = v6Bytes.readUint16BE(i).toString(16);
|
||||||
ps.push(hex);
|
ps.push(hex);
|
||||||
|
|
||||||
// check the necessity for compress
|
// check the necessity for compress
|
||||||
if (last_hex > -1
|
if (lastHex > -1
|
||||||
&& hex == 0 && last_hex == 0) {
|
&& hex == 0 && lastHex == 0) {
|
||||||
needCompress = true;
|
needCompress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the last hex
|
// reset the last hex
|
||||||
last_hex = hex;
|
lastHex = hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needCompress == false || compress === false) {
|
if (needCompress == false || compress === false) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue