UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

21 lines (17 loc) 534 B
/** * @file File extension extraction utility * @description Single responsibility: Extract file extension from file paths */ const path = require('path'); /** * Get the file extension from a path * @param {string} filePath - The file path * @returns {string} File extension including the dot (e.g., '.js', '.ts') */ function getPathExtension(filePath) { if (typeof filePath !== 'string') { throw new TypeError('File path must be a string'); } return path.extname(filePath); } module.exports = getPathExtension;