[JS] handle a breaking changes in os.networkInterfaces
In Node 18+, os.networkInterface's family is either 4 or 6,
os.networkInterface's family was either IPv4 or IPv6 until Node 16
@@ -48,7 +48,7 @@ function getIPAddress(loopback, family) {
}
for (let ipAddress of interfaces[key]) {
- if (ipAddress.family === family && ipAddress.internal === loopback) {
+ if ((ipAddress.family === family || `IPv${ipAddress.family}` === family) && ipAddress.internal === loopback) {
return ipAddress.address
}
}
