Spaces:
Sleeping
Sleeping
Download node_modules/@reduxjs/toolkit/src/query/utils/joinUrls.ts from Scribbler310/gs-port: direct link, hf CLI and curl.
- Browser
- Download file 581 Bytes
-
https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/utils/joinUrls.ts
- Command line
-
hf download hf://spaces/Scribbler310/gs-port/node_modules/@reduxjs/toolkit/src/query/utils/joinUrls.ts
-
curl -L -o joinUrls.ts https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/utils/joinUrls.ts
581 Bytes
| import { isAbsoluteUrl } from './isAbsoluteUrl' | |
| const withoutTrailingSlash = (url: string) => url.replace(/\/$/, '') | |
| const withoutLeadingSlash = (url: string) => url.replace(/^\//, '') | |
| export function joinUrls( | |
| base: string | undefined, | |
| url: string | undefined, | |
| ): string { | |
| if (!base) { | |
| return url! | |
| } | |
| if (!url) { | |
| return base | |
| } | |
| if (isAbsoluteUrl(url)) { | |
| return url | |
| } | |
| const delimiter = base.endsWith('/') || !url.startsWith('?') ? '/' : '' | |
| base = withoutTrailingSlash(base) | |
| url = withoutLeadingSlash(url) | |
| return `${base}${delimiter}${url}` | |
| } | |