Download next.js/packages/next/src/shared/lib/router/utils/add-path-suffix.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 449 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/add-path-suffix.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/shared/lib/router/utils/add-path-suffix.ts
-
curl -L -o add-path-suffix.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/add-path-suffix.ts
449 Bytes
| import { parsePath } from './parse-path' | |
| /** | |
| * Similarly to `addPathPrefix`, this function adds a suffix at the end on the | |
| * provided path. It also works only for paths ensuring the argument starts | |
| * with a slash. | |
| */ | |
| export function addPathSuffix(path: string, suffix?: string) { | |
| if (!path.startsWith('/') || !suffix) { | |
| return path | |
| } | |
| const { pathname, query, hash } = parsePath(path) | |
| return `${pathname}${suffix}${query}${hash}` | |
| } | |