mirror of
https://github.com/iib0011/omni-tools.git
synced 2026-11-30 09:00:33 +03:00
12 lines
332 B
TypeScript
12 lines
332 B
TypeScript
/**
|
|
* Returns the file extension
|
|
*
|
|
* @param {string} filename - The filename
|
|
* @return {string} - the file extension
|
|
*/
|
|
export function getFileExtension(filename: string): string {
|
|
const lastDot = filename.lastIndexOf('.');
|
|
if (lastDot <= 0) return ''; // No extension
|
|
return filename.slice(lastDot + 1).toLowerCase();
|
|
}
|