Skip to content

Commit 06bddb8

Browse files
committed
Simplify simpleCheck method
1 parent 512a8ce commit 06bddb8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/package-checker.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ const commandExists = cmd => {
1616

1717
const simpleCheck = (cmd, match = null, fork = true) => async (pkgs = []) => {
1818
try {
19-
if (fork) {
20-
await Promise.all(
21-
pkgs.map(pkg => exec(`${cmd} ${pkg}`))
22-
)
23-
} else {
24-
await exec(`${cmd} ${pkgs.join(' ')}`)
25-
}
19+
const execCheck = arg => exec([cmd, arg].join(' '))
20+
21+
const check = fork
22+
? Promise.all(pkgs.map(execCheck))
23+
: execCheck(pkgs.join(' '))
24+
25+
await check
2626
return true
2727
} catch (err) {
2828
if (match === null) return false

0 commit comments

Comments
 (0)