Files
vercel/packages/routing-utils
Steven f5f07c5d15 [all] Remove more "now" references (#5944)
Follow up to #5928 to remove a few more "now" references and replace with "vercel" where appropriate.
2021-03-08 10:08:09 -05:00
..

@vercel/routing-utils

Route validation utilities

Usage

yarn 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);