UNPKG

sveltekit-generator

Version:

Inspired by Laravel (php artisan make:)

9 lines (8 loc) 335 B
import chalk from 'chalk'; export const validateRouteName = (routeName) => { const isValid = /^[a-zA-Z0-9-()\/]+$/.test(routeName); if (!isValid) { console.log(chalk.red(`Error: Route name "${routeName}" is invalid. Only letters, numbers, hyphens, parentheses, and slashes are allowed.`)); } return isValid; };