@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
16 lines (15 loc) • 480 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFileExtension = getFileExtension;
const path_1 = require("path");
/**
* Get the file extension from a path / path segment without the dot
*/
function getFileExtension(segment) {
const extension = (0, path_1.extname)(segment);
if (extension && extension.startsWith(".")) {
// Remove the dot from the extension
return extension.slice(1);
}
return extension;
}