Created
November 25, 2019 10:22
-
-
Save michelepatrassi/b0752336384b3529f830c160769e19d7 to your computer and use it in GitHub Desktop.
Helper to get path and name from file URI
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
getPathAndFileName(fileUri: string): { path: string; name: string } => { | |
const splittedUri = fileUri.split('/').filter(x => x); | |
const path = `${splittedUri.slice(0, -1).join('/')}/`; | |
const name = splittedUri.slice(-1).join(); | |
return { path, name }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment