Skip to content

Commit 9e1f736

Browse files
jasnelltargos
authored andcommitted
test: minor refactor in common/index.js
PR-URL: #22738 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: George Adams <[email protected]>
1 parent e2b72c2 commit 9e1f736

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/common/index.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,14 @@ const PIPE = (() => {
143143
return path.join(pipePrefix, pipeName);
144144
})();
145145

146-
let hasIPv6;
147-
{
146+
const hasIPv6 = (() => {
148147
const iFaces = os.networkInterfaces();
149148
const re = isWindows ? /Loopback Pseudo-Interface/ : /lo/;
150-
hasIPv6 = Object.keys(iFaces).some(function(name) {
151-
return re.test(name) && iFaces[name].some(function(info) {
152-
return info.family === 'IPv6';
153-
});
149+
return Object.keys(iFaces).some((name) => {
150+
return re.test(name) &&
151+
iFaces[name].some(({ family }) => family === 'IPv6');
154152
});
155-
}
153+
})();
156154

157155
/*
158156
* Check that when running a test with

0 commit comments

Comments
 (0)