(urlObject: URL)
| 2 | import { IVersion } from "./Interfaces"; |
| 3 | |
| 4 | export const getVersionByRequest = (urlObject: URL): IVersion | undefined => { |
| 5 | // Application configuration is need for the default setting. |
| 6 | const api = APIService.getInstance(); |
| 7 | const matchedVersion = api.versions.find((version) => { |
| 8 | const path = `/${api.config.prefix}/${version.name}`; |
| 9 | return urlObject.pathname.startsWith(path); |
| 10 | }); |
| 11 | |
| 12 | return matchedVersion; |
| 13 | }; |
no test coverage detected