generated from DenoPlayground/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
/** | ||
* This function takes in a path to a file and returns the file extension (without the `.`). | ||
* | ||
* @param path The path to the file | ||
* @returns The file extension | ||
* @returns The file extension or undefined if no file extension was found | ||
*/ | ||
export function getFileExtension(path : string) : string { | ||
export function getFileExtension(path : string) : string | undefined { | ||
return path.replace(/.+\.([^/.]+$)/, (_, extension) => extension); | ||
} |
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