agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
41 lines (36 loc) • 1.6 kB
JavaScript
class UserService {
validateUser(user) {
if (!user) throw new Error('User is required');
if (!user.id) throw new Error('User ID is required');
if (!user.name) throw new Error('User name is required');
if (!user.email) throw new Error('User email is required');
return true;
}
processUser(user) {
if (!user) throw new Error('User is required');
if (!user.id) throw new Error('User ID is required');
if (!user.name) throw new Error('User name is required');
if (!user.email) throw new Error('User email is required');
// Additional processing
user.processedAt = new Date();
return user;
}
}
class ProductService {
validateProduct(product) {
if (!product) throw new Error('Product is required');
if (!product.id) throw new Error('Product ID is required');
if (!product.name) throw new Error('Product name is required');
if (!product.price) throw new Error('Product price is required');
return true;
}
processProduct(product) {
if (!product) throw new Error('Product is required');
if (!product.id) throw new Error('Product ID is required');
if (!product.name) throw new Error('Product name is required');
if (!product.price) throw new Error('Product price is required');
// Additional processing
product.processedAt = new Date();
return product;
}
}