mcp-image-server
Version:
Servidor MCP para geração de imagens e ícones, integrado ao Vibecoding.
25 lines (24 loc) • 901 B
JavaScript
export function validateImageOptions(options) {
const { width, height, format } = options;
if (typeof width !== 'number' || width <= 0) {
throw new Error('Width must be a positive number.');
}
if (typeof height !== 'number' || height <= 0) {
throw new Error('Height must be a positive number.');
}
const validFormats = ['jpeg', 'png', 'gif'];
if (!validFormats.includes(format)) {
throw new Error(`Format must be one of the following: ${validFormats.join(', ')}.`);
}
return true;
}
export function validateIconOptions(options) {
const { size, template } = options;
if (typeof size !== 'number' || size <= 0) {
throw new Error('Size must be a positive number.');
}
if (typeof template !== 'string' || template.trim() === '') {
throw new Error('Template must be a non-empty string.');
}
return true;
}