Improve regex in utils.parseVersion

This commit is contained in:
Shivam Mathur
2021-02-05 04:42:33 +05:30
parent 86e1ccdd8d
commit 912f27c42c
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ export async function fetch(url: string): Promise<string> {
export async function parseVersion(version: string): Promise<string> {
const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json';
switch (true) {
case /latest|\d.x/.test(version):
case /^(latest|\d+\.x)$/.test(version):
return JSON.parse(await fetch(manifest))[version];
default:
switch (true) {