astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
17 lines (16 loc) • 575 B
JavaScript
import { trimSlashes } from "../path.js";
import { getRouteGenerator } from "./generator.js";
import { validateGetStaticPathsParameter } from "./internal/validation.js";
function stringifyParams(params, route, trailingSlash) {
const validatedParams = {};
for (const [key, value] of Object.entries(params)) {
validateGetStaticPathsParameter([key, value], route.component);
if (value !== void 0) {
validatedParams[key] = trimSlashes(value);
}
}
return getRouteGenerator(route.segments, trailingSlash)(validatedParams);
}
export {
stringifyParams
};