UNPKG

astro

Version:

Astro is a modern site builder with web best practices, performance, and DX front-of-mind.

17 lines (16 loc) 533 B
import { trimSlashes } from "../path.js"; import { validateGetStaticPathsParameter } from "./validation.js"; function stringifyParams(params, route) { const validatedParams = Object.entries(params).reduce((acc, next) => { validateGetStaticPathsParameter(next, route.component); const [key, value] = next; if (value !== void 0) { acc[key] = typeof value === "string" ? trimSlashes(value) : value.toString(); } return acc; }, {}); return route.generate(validatedParams); } export { stringifyParams };