Skip to content

Commit 00b5cda

Browse files
authored
fix: replace reduce with flatMap (#106)
1 parent 457f595 commit 00b5cda

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ const getPathInfo = (cmd, {
3131
if (isWindows) {
3232
const pathExtExe = optPathExt ||
3333
['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)
34-
const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item) => {
35-
acc.push(item)
36-
acc.push(item.toLowerCase())
37-
return acc
38-
}, [])
34+
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()])
3935
if (cmd.includes('.') && pathExt[0] !== '') {
4036
pathExt.unshift('')
4137
}

0 commit comments

Comments
 (0)