Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static getAddress6(host: string): Address6 | null | undefined {
const parts = host.split('.');
return parts.length === 4 ? Address6.fromAddress4(host) : new Address6(host);
}
.map((peer) => {
const { address, port } = peer;
let canonicalForm = new Address6(address).canonicalForm() as string | undefined | null;
if (canonicalForm == undefined) {
canonicalForm = Address6.fromAddress4(address).canonicalForm() as string | undefined | null;
}
return { host: canonicalForm == undefined ? '' : canonicalForm, port };
})
.filter((endpoint) => !LOCAL_HOST_ADDRESSES.has(endpoint.host))