- 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
13 lines
384 B
JavaScript
13 lines
384 B
JavaScript
export function computeProcessorScale(maxPixels, w, h) {
|
|
try {
|
|
const mp = Number(maxPixels) || 0;
|
|
const pixels = (Number(w) || 0) * (Number(h) || 0);
|
|
if (!(pixels > 0)) return 1;
|
|
if (!(mp > 0)) return 1;
|
|
if (pixels <= mp) return 1;
|
|
return Math.max(0.05, Math.min(1, Math.sqrt(mp / pixels)));
|
|
} catch {
|
|
return 1;
|
|
}
|
|
}
|