This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -776,13 +776,21 @@ function getPackageString(packageObject: Package): string {
776
776
777
777
function getPackageMetricsString ( packageObject : PackageWithMetrics ) : string {
778
778
if ( ! packageObject || ! packageObject . metrics ) {
779
- return "" ;
779
+ return "" + chalk . magenta ( "No installs recorded" ) ;
780
780
}
781
781
782
782
var activePercent : number = packageObject . metrics . totalActive
783
783
? packageObject . metrics . active / packageObject . metrics . totalActive * 100
784
784
: 0.0 ;
785
- var percentString : string = ( activePercent === 100.0 ? "100" : activePercent . toPrecision ( 2 ) ) + "%" ;
785
+ var percentString : string ;
786
+ if ( activePercent === 100.0 ) {
787
+ percentString = "100%" ;
788
+ } else if ( activePercent === 0.0 ) {
789
+ percentString = "0%" ;
790
+ } else {
791
+ percentString = activePercent . toPrecision ( 2 ) + "%" ;
792
+ }
793
+
786
794
var numPending : number = packageObject . metrics . downloaded - packageObject . metrics . installed - packageObject . metrics . failed ;
787
795
var returnString : string = chalk . green ( "Active: " ) + percentString + " (" + packageObject . metrics . active . toLocaleString ( ) + " of " + packageObject . metrics . totalActive . toLocaleString ( ) + ")\n" +
788
796
chalk . green ( "Total: " ) + packageObject . metrics . installed . toLocaleString ( ) ;
You can’t perform that action at this time.
0 commit comments