Skip to content

Commit

Permalink
gardening
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Dec 16, 2022
1 parent ea581e6 commit 8f9c077
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/utils/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ export function compare(a: Package, b: Package): number {
}

export function str(pkg: Package | PackageRequirement): string {
if ("constraint" in pkg) {
if (pkg.constraint.set === "*") {
return pkg.project
} else {
return `${pkg.project}${pkg.constraint.toString()}`
}
if (!("constraint" in pkg)) {
return `${pkg.project}=${pkg.version}`
} else if (pkg.constraint.set === "*") {
return pkg.project
} else {
return `${pkg.project}=${pkg.version.toString()}`
return `${pkg.project}${pkg.constraint}`
}
}

0 comments on commit 8f9c077

Please sign in to comment.