Skip to content

Instantly share code, notes, and snippets.

@ArnaudBuchholz
Created April 28, 2020 02:28
Show Gist options
  • Save ArnaudBuchholz/186535fbcfc46412154fcbda1042809f to your computer and use it in GitHub Desktop.
Save ArnaudBuchholz/186535fbcfc46412154fcbda1042809f to your computer and use it in GitHub Desktop.
let caseSensitive = true
function getEntry (entryPath) {
if (!caseSensitive) {
entryPath = entryPath.toLowerCase()
}
if (entryPath === '/') {
return entries
}
return entryPath.split(path.sep).slice(1).reduce((folder, name) => {
if (!folder || folder.content) {
return folder
}
return folder[name]
}, entries)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment