agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
25 lines (20 loc) • 730 B
JavaScript
/**
* @file Cross-platform path normalization utility
* @description Single responsibility: Normalize file paths for consistent cross-platform behavior
*/
const path = require('path');
/**
* Normalize a file path for cross-platform compatibility
* @param {string} inputPath - The path to normalize
* @returns {string} Normalized path with proper separators
*/
function normalizePath(inputPath) {
if (!inputPath || typeof inputPath !== 'string') {
return '';
}
// Use path.normalize for proper platform handling
const normalized = path.normalize(inputPath);
// Always use forward slashes for consistent cross-platform behavior
return normalized.replace(/\\/g, '/');
}
module.exports = normalizePath;