@varlinor/node-tools
Version:
This package provides a collection of utility functions for Node.js environments, focusing on file operations, JSON parsing, dependency management, and Vue component scanning. It includes functions for recursively scanning directories, loading and parsing
18 lines (15 loc) • 378 B
JavaScript
function normalizePath(filePath) {
if (filePath) {
return filePath.replace(/\\/g, "/");
}
return filePath;
}
function removeFileExt(path) {
const lastDotIndex = path.lastIndexOf(".");
if (lastDotIndex === -1)
return path;
return path.substring(0, lastDotIndex);
}
exports.normalizePath = normalizePath;
exports.removeFileExt = removeFileExt;
;