Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

console-progress-bar

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-progress-bar - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

26

app.js

@@ -0,1 +1,4 @@

// Import.
const CColor = require('ccolor');
// Constants.

@@ -39,4 +42,4 @@ const ENCODING = 'utf8';

this.value = 0;
this.percent = 0;
this.filledParts = 0;
this.percent = -1;
this.filledParts = -1;
this.maxValue = progressBarOptions.maxValue;

@@ -72,4 +75,5 @@ this.startChars = progressBarOptions.startChars;

const progressBarString = `${this.startChars}${filledPartsCharsString}${notFilledPartCharsString}${this.endChars}`;
const progressBarStringWithColor = addColor(progressBarString, this.percent);
const newLineIfLast = this.percent === 100 ? '\n' : '';
process.stdout.write(`\r${progressBarString}${newLineIfLast}`);
process.stdout.write(`\r${progressBarStringWithColor}${newLineIfLast}`);
}

@@ -117,3 +121,19 @@

/**
* Add color.
* @param {string} progressBarString - Progress bar string.
* @param {number} percent - Percent.
* @return {string}
*/
function addColor(progressBarString, percent) {
// Set color accordance to percent value.
switch (percent) {
case 100:
return CColor.green(progressBarString);
default:
return CColor.yellow(progressBarString);
}
}
// Export.
module.exports = ConsoleProgressBar;

7

package.json
{
"name": "console-progress-bar",
"version": "0.0.4",
"version": "0.1.0",
"description": "Console progress bar",

@@ -24,3 +24,6 @@ "main": "app.js",

},
"homepage": "https://gitlab.com/vsichka/console-progress-bar.npm#README"
"homepage": "https://gitlab.com/vsichka/console-progress-bar.npm#README",
"dependencies": {
"ccolor": "^1.0.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc