3.1.1 • Published 1 month ago

@khulnasoft/routing-utils v3.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 month ago

@khulnasoft/routing-utils

Route validation utilities

Usage

npm add @khulnasoft/routing-utils

import { normalizeRoutes } from '@khulnasoft/routing-utils';

const { routes, error } = normalizeRoutes(inputRoutes);

if (error) {
  console.log(error.code, error.message);
}
import { routesSchema } from '@khulnasoft/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);