mirror of
https://github.com/fluencelabs/js-multiaddr-to-uri
synced 2024-12-05 03:30:25 +00:00
fix: add all protocols
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
parent
ac2d98c49a
commit
7fbb65a470
6
index.js
6
index.js
@ -4,9 +4,9 @@ const reduceValue = (_, v) => v
|
|||||||
const Reducers = {
|
const Reducers = {
|
||||||
ip4: reduceValue,
|
ip4: reduceValue,
|
||||||
ip6: (str, content, i, parts) => (
|
ip6: (str, content, i, parts) => (
|
||||||
parts.some(p => ['tcp', 'udp', 'http', 'https', 'ws', 'wss'].includes(p.protocol))
|
parts.length === 1 && parts[0].protocol === 'ip6'
|
||||||
? `[${content}]`
|
? content
|
||||||
: content
|
: `[${content}]`
|
||||||
),
|
),
|
||||||
tcp: (str, content, i, parts) => (
|
tcp: (str, content, i, parts) => (
|
||||||
parts.some(p => ['http', 'https', 'ws', 'wss'].includes(p.protocol))
|
parts.some(p => ['http', 'https', 'ws', 'wss'].includes(p.protocol))
|
||||||
|
Loading…
Reference in New Issue
Block a user