Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 912f27c

Browse files
committed
Improve regex in utils.parseVersion
1 parent 86e1ccd commit 912f27c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ exports.fetch = fetch;
11211121
async function parseVersion(version) {
11221122
const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json';
11231123
switch (true) {
1124-
case /latest|\d.x/.test(version):
1124+
case /^(latest|\d+\.x)$/.test(version):
11251125
return JSON.parse(await fetch(manifest))[version];
11261126
default:
11271127
switch (true) {

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export async function fetch(url: string): Promise<string> {
6969
export async function parseVersion(version: string): Promise<string> {
7070
const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json';
7171
switch (true) {
72-
case /latest|\d.x/.test(version):
72+
case /^(latest|\d+\.x)$/.test(version):
7373
return JSON.parse(await fetch(manifest))[version];
7474
default:
7575
switch (true) {

0 commit comments

Comments
 (0)