fix: add all protocols

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias 2019-01-13 10:22:17 +00:00
parent ac2d98c49a
commit 7fbb65a470

View File

@ -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))