/opt/canhelp/node_modules/next/dist/esm/shared/lib/page-path
Edit: /opt/canhelp/node_modules/next/dist/esm/shared/lib/page-path/normalize-data-path.js (481B)
import { pathHasPrefix } from '../router/utils/path-has-prefix';
/**
* strip _next/data/
/ prefix and .json suffix
*/ export function normalizeDataPath(pathname) {
if (!pathHasPrefix(pathname || '/', '/_next/data')) {
return pathname;
}
pathname = pathname.replace(/\/_next\/data\/[^/]{1,}/, '').replace(/\.json$/, '');
if (pathname === '/index') {
return '/';
}
return pathname;
}
//# sourceMappingURL=normalize-data-path.js.map