Skip to content

Instantly share code, notes, and snippets.

@michelepatrassi
Created November 25, 2019 10:22
Show Gist options
  • Save michelepatrassi/b0752336384b3529f830c160769e19d7 to your computer and use it in GitHub Desktop.
Save michelepatrassi/b0752336384b3529f830c160769e19d7 to your computer and use it in GitHub Desktop.
Helper to get path and name from file URI
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