(input: string)
| 7 | } |
| 8 | |
| 9 | export function parseSkillInput(input: string): ParsedSkillInput | null { |
| 10 | const urlMatch = input.match( |
| 11 | /(?:https?:\/\/)?github\.com\/([^\/]+)\/([^\/]+)\/tree\/([^\/]+)\/(.+)/ |
| 12 | ); |
| 13 | if (urlMatch) { |
| 14 | const [, owner, repo, branch, path] = urlMatch; |
| 15 | return { type: "url", owner, repo, branch, path }; |
| 16 | } |
| 17 | |
| 18 | const shortMatch = input.match(/^\/?([^\/]+)\/([^\/]+)$/); |
| 19 | if (shortMatch) { |
| 20 | const [, owner, repo] = shortMatch; |
| 21 | return { type: "repo", owner, repo }; |
| 22 | } |
| 23 | |
| 24 | return null; |
| 25 | } |
no outgoing calls
no test coverage detected