Download frontend/src/utils/parse-github-url.ts from ar08/zzz: direct link, hf CLI and curl.
- Browser
- Download file 511 Bytes
-
https://huggingface.co/spaces/ar08/zzz/resolve/main/frontend/src/utils/parse-github-url.ts
- Command line
-
hf download hf://spaces/ar08/zzz/frontend/src/utils/parse-github-url.ts
-
curl -L -o parse-github-url.ts https://huggingface.co/spaces/ar08/zzz/resolve/main/frontend/src/utils/parse-github-url.ts
511 Bytes
| /** | |
| * Given a GitHub URL of a repository, obtain the owner and repository name | |
| * @param url The GitHub repository URL | |
| * @returns An array containing the owner and repository names | |
| * | |
| * @example | |
| * const parsed = parseGithubUrl("https://github.com/All-Hands-AI/OpenHands"); | |
| * console.log(parsed) // ["All-Hands-AI", "OpenHands"] | |
| */ | |
| export const parseGithubUrl = (url: string) => { | |
| const parts = url.replace("https://github.com/", "").split("/"); | |
| return parts.length === 2 ? parts : []; | |
| }; | |