UNPKG

@sigi/ssr

Version:

Server side rendering support for sigi framework

14 lines 517 B
import { match as matchPath } from 'path-to-regexp'; import { SKIP_SYMBOL } from './run'; export function match(routers, pathFactory) { return (payloadGetter) => { return function payloadGetterWithMatch(ctx, skip) { const requestPath = pathFactory(ctx); if (requestPath && routers.some((router) => matchPath(router)(requestPath))) { return payloadGetter(ctx, skip); } return SKIP_SYMBOL; }; }; } //# sourceMappingURL=match.js.map