Skip to content

Commit

Permalink
fix: remove flat pollyfill in get-files
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoRBaquero authored Aug 6, 2021
1 parent 6f5158d commit 2dbd091
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions get-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ const junk = require('junk')
const once = require('once')
const parallel = require('run-parallel')

// TODO: When Node 10 support is dropped, replace this with Array.prototype.flat
function flat (arr1) {
return arr1.reduce(
(acc, val) => Array.isArray(val)
? acc.concat(flat(val))
: acc.concat(val),
[]
)
}

function notHidden (file) {
return file[0] !== '.'
}
Expand Down Expand Up @@ -48,7 +38,7 @@ function getFiles (path, keepRoot, cb) {
traversePath(path, getFileInfo, (err, files) => {
if (err) return cb(err)

if (Array.isArray(files)) files = flat(files)
if (Array.isArray(files)) files = files.flat()
else files = [files]

path = corePath.normalize(path)
Expand Down

0 comments on commit 2dbd091

Please sign in to comment.