Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: os, replace custom flatten method with built-in Array.flat
  • Loading branch information
waelsy123 committed May 22, 2021
commit 2585ca44e1c776d1ceb7a0631f2ecffa58de5eb6
7 changes: 2 additions & 5 deletions test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)
Comment thread
waelsy123 marked this conversation as resolved.
Outdated

Comment thread
jasnell marked this conversation as resolved.
Outdated
.map((v) => ({ v, mask: netmaskToCIDRSuffixMap.get(v.netmask) }))
.forEach(({ v, mask }) => {
assert.ok('cidr' in v, `"cidr" prop not found in ${inspect(v)}`);
Expand Down