UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

25 lines (21 loc) 899 B
function processUserData(user) { if (!user.name) throw new Error('Name required'); if (!user.email) throw new Error('Email required'); user.name = user.name.trim(); user.email = user.email.toLowerCase(); return user; } function processProductData(product) { if (!product.title) throw new Error('Title required'); if (!product.price) throw new Error('Price required'); product.title = product.title.trim(); product.price = parseFloat(product.price); return product; } function processOrderData(order) { if (!order.items) throw new Error('Items required'); if (!order.total) throw new Error('Total required'); order.items = order.items.filter(item => item.quantity > 0); order.total = parseFloat(order.total); return order; }