function IPv6(parts, zoneId) {
            let i;
            let
                part;

            if (parts.length === 16) {
                this.parts = [];
                for (i = 0; i <= 14; i += 2) {
                    this.parts.push((parts[i] << 8) | parts[i + 1]);
                }
            } else if (parts.length === 8) {
                this.parts = parts;
            } else {
                throw new Error("ipaddr: ipv6 part count should be 8 or 16");
            }

            for (i = 0; i < this.parts.length; i++) {
                part = this.parts[i];
                if (!((part >= 0 && part <= 0xffff))) {
                    throw new Error("ipaddr: ipv6 part should fit in 16 bits");
                }
            }

            if (zoneId) {
                this.zoneId = zoneId;
            }
        }
// Throws an error if the input is invalid.
Throws an error if the input is invalid.
Throws an error if the input is invalid .
function IPv6(parts, zoneId) {
            let i;
            let
                part;
            if (parts.length === 16) {
                this.parts = [];
                for (i = 0; i <= 14; i += 2) {
                    this.parts.push((parts[i] << 8) | parts[i + 1]);
                }
            } else if (parts.length === 8) {
                this.parts = parts;
            } else {
                throw new Error("ipaddr: ipv6 part count should be 8 or 16");
            }
            for (i = 0; i < this.parts.length; i++) {
                part = this.parts[i];
                if (!((part >= 0 && part <= 0xffff))) {
                    throw new Error("ipaddr: ipv6 part should fit in 16 bits");
                }
            }
            if (zoneId) {
                this.zoneId = zoneId;
            }
        }
function IPv6 ( parts , zoneId ) { let i ; let part ; if ( parts . length === 16 ) { this . parts = [ ] ; for ( i = 0 ; i <= 14 ; i += 2 ) { this . parts . push ( ( parts [ i ] << 8 ) | parts [ i + 1 ] ) ; } } else if ( parts . length === 8 ) { this . parts = parts ; } else { throw new Error ( "ipaddr: ipv6 part count should be 8 or 16" ) ; } for ( i = 0 ; i < this . parts . length ; i ++ ) { part = this . parts [ i ] ; if ( ! ( ( part >= 0 && part <= 0xffff ) ) ) { throw new Error ( "ipaddr: ipv6 part should fit in 16 bits" ) ; } } if ( zoneId ) { this . zoneId = zoneId ; } }
Throws an error if the input is invalid.
Throws an error if the input is invalid .