Created
April 28, 2020 02:28
-
-
Save ArnaudBuchholz/186535fbcfc46412154fcbda1042809f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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