All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.util.getFileExtension.js Maven / Gradle / Ivy

/**
 * ""                        -> ""
 * "noExtension"             -> ""
 * "file.txt"                -> ".txt"
 * "file.with.many.dots.doc" -> ".doc"
 * ".gitignore"              -> ""
 *
 * @param { string } fileName - the file name
 * @returns { string }
 */
const getFileExtension = (fileName) => {
    const dotPos = fileName.lastIndexOf(".");
    if (dotPos < 1) {
        return "";
    }
    return fileName.slice(dotPos);
};
export default getFileExtension;
//# sourceMappingURL=getFileExtension.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy