or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

component-manipulation.mdfragment-extensions.mdindex.mdipv6-support.mdjquery-integration.mdnormalization-encoding.mdpath-manipulation.mdquery-management.mdresolution-comparison.mdsecond-level-domains.mdstatic-utilities.mduri-construction.mduri-templates.md

ipv6-support.mddocs/

0

# IPv6 Support

1

2

Specialized support for IPv6 address handling and normalization with optimal text representation.

3

4

## Capabilities

5

6

### IPv6 Address Normalization

7

8

```javascript { .api }

9

/**

10

* Convert IPv6 address to best text representation

11

* @param address - IPv6 address string to normalize

12

* @returns Optimized IPv6 address representation

13

*/

14

IPv6.best(address: string): string;

15

16

/**

17

* Restore previous IPv6 variable

18

* @returns Previous IPv6 variable value

19

*/

20

IPv6.noConflict(): any;

21

```

22

23

**Usage Examples:**

24

25

```javascript

26

// Import IPv6 module

27

import IPv6 from 'urijs/src/IPv6';

28

29

// Normalize IPv6 addresses

30

const longForm = '2001:0db8:0000:0000:0000:0000:0000:0001';

31

const optimized = IPv6.best(longForm);

32

console.log(optimized); // '2001:db8::1'

33

34

// Handle zero compression

35

const withZeros = '2001:db8:0:0:1:0:0:1';

36

const compressed = IPv6.best(withZeros);

37

console.log(compressed); // '2001:db8::1:0:0:1'

38

39

// Mixed IPv4-IPv6 addresses

40

const mixed = '::ffff:192.168.1.1';

41

const mixedOpt = IPv6.best(mixed);

42

console.log(mixedOpt); // '::ffff:192.168.1.1' (already optimal)

43

44

// Use with URI.js

45

const uri = new URI('http://[2001:db8::1]:8080/path');

46

console.log(uri.hostname()); // '2001:db8::1'

47

console.log(uri.is('ip6')); // true

48

```