Skip to content

Commit

Permalink
fix: replace reduce with flatMap (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
green961 authored Aug 10, 2023
1 parent 457f595 commit 00b5cda
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ const getPathInfo = (cmd, {
if (isWindows) {
const pathExtExe = optPathExt ||
['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter)
const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item) => {
acc.push(item)
acc.push(item.toLowerCase())
return acc
}, [])
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()])
if (cmd.includes('.') && pathExt[0] !== '') {
pathExt.unshift('')
}
Expand Down

0 comments on commit 00b5cda

Please sign in to comment.