Skip to content

Commit

Permalink
Revert "Using RegExp replace loop in isHidden (#109)" (#138)
Browse files Browse the repository at this point in the history
This reverts commit 8330028.
  • Loading branch information
niftylettuce committed May 15, 2020
1 parent 8330028 commit 2cb7888
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Expand Up @@ -147,10 +147,11 @@ async function send (ctx, path, opts = {}) {
*/

function isHidden (root, path) {
const hiddenFileReg = new RegExp(`${sep}\\.`)
path = path.substr(root.length)

return hiddenFileReg.test(path)
path = path.substr(root.length).split(sep)
for (let i = 0; i < path.length; i++) {
if (path[i][0] === '.') return true
}
return false
}

/**
Expand Down

0 comments on commit 2cb7888

Please sign in to comment.