(url, param)
| 56 | * @returns The string value of the query parameter |
| 57 | */ |
| 58 | const getStringQueryParam = (url, param) => { |
| 59 | // Native URL object uses .search (with leading ?) not .query |
| 60 | const queryString = url.search ? url.search.slice(1) : '' |
| 61 | const query = qs.parse(queryString) |
| 62 | const value = query[param] |
| 63 | // Check if the value is an array and return the first element if so. |
| 64 | // Otherwise, return the value directly. |
| 65 | return Array.isArray(value) ? value[0] : value |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Parses a GitHub URL and returns repository information |
no outgoing calls
no test coverage detected
searching dependent graphs…