Files
MajoorWaldi-ComfyUI-Majoor-…/js/utils/path.js
T
MajoorWaldi dc72be0139 feat: enhance JS testing and linting setup
- Added coverage reporting for Vitest with configuration in vitest.config.mjs
- Updated package.json to include new scripts for JS coverage, linting, and formatting
- Modified run_quality_gate.py to allow skipping ESLint and Prettier checks
- Introduced .prettierrc for consistent code formatting
- Created .prettierignore to exclude specific files and directories from formatting
2026-03-28 14:14:28 +01:00

23 lines
635 B
JavaScript

/**
* Shared path utilities for frontend modules.
*/
export function toPosixPath(value) {
return String(value || "").replace(/\\/g, "/");
}
export function splitFilenameAndSubfolder(value) {
const normalized = toPosixPath(value).trim();
if (!normalized) return { filename: "", subfolder: "" };
const idx = normalized.lastIndexOf("/");
if (idx < 0) return { filename: normalized, subfolder: "" };
return {
filename: normalized.slice(idx + 1),
subfolder: normalized.slice(0, idx),
};
}
export function hasWindowsDrivePrefix(value) {
return /^[a-zA-Z]:\//.test(String(value || ""));
}