Created
September 16, 2019 13:53
-
-
Save anthify/681345e2cff576c2ea1062c5fde3150c to your computer and use it in GitHub Desktop.
Takes path string and returns directory, filename, and extension in object.
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
export default path => ({ | |
dir: path.substring(0, path.lastIndexOf('/')), | |
filename: path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.')), | |
ext: path.substring(path.lastIndexOf('.') + 1) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment