Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Nov 28, 2022
1 parent 4205441 commit 2d6f832
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/babel-helper-compilation-targets/src/utils.ts
Expand Up @@ -29,11 +29,14 @@ export function semverify(version: number | string): string {
`'${version}' is not a valid version`,
);

const split = version.toString().split(".");
while (split.length < 3) {
split.push("0");
version = version.toString();

let pos = 0;
let num = 0;
while ((pos = version.indexOf(".", pos + 1)) > 0) {
num++;
}
return split.join(".");
return version + ".0".repeat(2 - num);
}

export function isUnreleasedVersion(
Expand Down

0 comments on commit 2d6f832

Please sign in to comment.