diff --git a/lib/index.js b/lib/index.js index 52e9ea6..2de436c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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('') }