mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 07:45:00 -04:00
Fixed compilation errors
This commit is contained in:
parent
ea8acc6035
commit
05f51b30d0
1 changed files with 4 additions and 4 deletions
|
@ -390,19 +390,19 @@ export function strToIpv6(ipStr, retArr=true) {
|
||||||
*
|
*
|
||||||
* @param {string} ipStr
|
* @param {string} ipStr
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // returns "5555:126f:0000:0000:0000:0000:0000:0001"
|
* // returns "5555:126f:0000:0000:0000:0000:0000:0001"
|
||||||
* expandIpv6("5555:126f::0001");
|
* expandIpv6("5555:126f::0001");
|
||||||
*/
|
*/
|
||||||
export function expandIpv6(ipStr) {
|
export function expandIpv6(ipStr) {
|
||||||
const compactIndex = ipStr.search("::");
|
const compactIndex = ipStr.search("::");
|
||||||
let expandedStr = ipStr.substring(0, compactIndex); // 1234:5678::..
|
let expandedStr = ipStr.substring(0, compactIndex); // 1234:5678::..
|
||||||
const insertOffset = compactIndex == 0;
|
const insertOffset = compactIndex === 0; // 0 / 1
|
||||||
const ipEnd = ipStr.substring(compactIndex + 1); // :7ABC:DEFG:...
|
const ipEnd = ipStr.substring(compactIndex + 1); // :7ABC:DEFG:...
|
||||||
const missingChars = 39 - (expandedStr.length + ipEnd.length);
|
const missingChars = 39 - (expandedStr.length + ipEnd.length);
|
||||||
for (let i = insertOffset; i < missingChars + insertOffset; i++) {
|
for (let i = insertOffset; i < missingChars + insertOffset; i++) {
|
||||||
if (i % 5 == 0) {
|
if (i % 5 === 0) {
|
||||||
expandedStr += ":";
|
expandedStr += ":";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue