Download next.js/packages/next/src/shared/lib/router/utils/get-asset-path-from-route.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 410 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/get-asset-path-from-route.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/shared/lib/router/utils/get-asset-path-from-route.ts
-
curl -L -o get-asset-path-from-route.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/get-asset-path-from-route.ts
410 Bytes
| // Translates a logical route into its pages asset path (relative from a common prefix) | |
| // "asset path" being its javascript file, data file, prerendered html,... | |
| export default function getAssetPathFromRoute( | |
| route: string, | |
| ext: string = '' | |
| ): string { | |
| const path = | |
| route === '/' | |
| ? '/index' | |
| : /^\/index(\/|$)/.test(route) | |
| ? `/index${route}` | |
| : route | |
| return path + ext | |
| } | |