Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Refactor the _catch all type validation_ #22

Open
daviddias opened this issue Sep 11, 2017 · 1 comment
Open

Refactor the _catch all type validation_ #22

daviddias opened this issue Sep 11, 2017 · 1 comment

Comments

@daviddias
Copy link
Member

Currently, https://github.com/libp2p/js-libp2p-websocket-star/blob/master/src/utils.js#L46-L70 checks for the supported types. This is a tad complex and having this sort of "catch all and verify if this is in the circle of types I support" makes it hard to read.

Instead, be explicit. If you are looking to check if it is a valid multiaddr, use multiaddr.isMultiaddr

@mkg20001
Copy link
Member

I don't know how. The multiaddr is sent as a string to the client/server. multiaddr.isMultiaddr(str) returns false afaik.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants