const path = require('path'); function findDestination(filename, config) { const ext = path.extname(filename).slice(1).toLowerCase(); for (const rule of config.rules || []) { if ((rule.ext || '').toLowerCase() !== ext) { continue; } if (!rule.pattern) { return rule.destination; } const regex = new RegExp(rule.pattern); if (regex.test(path.basename(filename))) { return rule.destination; } } return null; } function isCadFile(filename) { const ext = path.extname(filename).slice(1).toLowerCase(); return ['prt', 'asm', 'drw'].includes(ext); } module.exports = { findDestination, isCadFile };