Skip to content

Commit

Permalink
fix(semver): add a necessary grouping, fix prerelease parsing (#3674)
Browse files Browse the repository at this point in the history
  • Loading branch information
futsuuu authored Sep 25, 2023
1 parent ea9dbdb commit 2884033
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion semver/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function parse(version: string | SemVer): SemVer {
}

// number-ify any prerelease numeric ids
const numericIdentifier = new RegExp(`^${src[NUMERICIDENTIFIER]}$`);
const numericIdentifier = new RegExp(`^(${src[NUMERICIDENTIFIER]})$`);
const prerelease = (m[4] ?? "")
.split(".")
.filter((id) => id)
Expand Down
2 changes: 2 additions & 0 deletions semver/parse_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Deno.test("prerelease", async (t) => {
["1.0.0-beta.2", ["beta", 2]],
["v0.5.4-pre", ["pre"]],
["1.2.2-alpha.1", ["alpha", 1]],
["1.2.0-1b3-4", ["1b3-4"]],
["1.2.0-3.6-pre2", [3, "6-pre2"]],
["2.0.0", []],
];

Expand Down

0 comments on commit 2884033

Please sign in to comment.