diff --git a/src/utils/pkg.ts b/src/utils/pkg.ts index d8670dd8..f6853f5b 100644 --- a/src/utils/pkg.ts +++ b/src/utils/pkg.ts @@ -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}` } }