@vercel/routing-utils
v3.1.0
Published
Vercel routing utilities
Downloads
3,443,107
Keywords
Readme
@vercel/routing-utils
Route validation utilities
Usage
npm add @vercel/routing-utils
import { normalizeRoutes } from '@vercel/routing-utils';
const { routes, error } = normalizeRoutes(inputRoutes);
if (error) {
console.log(error.code, error.message);
}
import { routesSchema } from '@vercel/routing-utils';
const ajv = new Ajv();
const validate = ajv.compile(routesSchema);
const valid = validate([{ src: '/about', dest: '/about.html' }]);
if (!valid) console.log(validate.errors);