diff options
author | Wael Almattar <waelsy123@gmail.com> | 2021-05-22 18:06:57 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-05-31 22:34:54 +0300 |
commit | 6d86f8afd5026e72e63d99c9334064b86092163d (patch) | |
tree | 8ddbd7d80650d60a5cbedae4454e805b0672f02b /test | |
parent | 9054d25acc5d3b6dcb8ea53351d9b3027f9d68e1 (diff) |
test: os, replace custom flatten method with built-in Array.flat
PR-URL: https://github.com/nodejs/node/pull/38770
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-os.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 6a5b4336824..922bab276bc 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -39,10 +39,6 @@ const is = { } }; -const flatten = (arr) => - arr.reduce((acc, c) => - acc.concat(Array.isArray(c) ? flatten(c) : c), []); - process.env.TMPDIR = '/tmpdir'; process.env.TMP = '/tmp'; process.env.TEMP = '/temp'; @@ -174,7 +170,8 @@ const netmaskToCIDRSuffixMap = new Map(Object.entries({ 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff': 128 })); -flatten(Object.values(interfaces)) +Object.values(interfaces) + .flat(Infinity) .map((v) => ({ v, mask: netmaskToCIDRSuffixMap.get(v.netmask) })) .forEach(({ v, mask }) => { assert.ok('cidr' in v, `"cidr" prop not found in ${inspect(v)}`); |