Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@yetnt/progressbar
Advanced tools
A progress bar creator in javascript typescript!
NOTE: All examples and explanations are in javascript.
npm i @yetnt/progressbar
const { progressBar, ProgressBar } = require('@yetnt/progressbar')
progressBar(percentage, barWidth, emptyChars, fullChars, returnAr?, firstEdgeOverride?, lastEdgeOverride?)
percentage = 45 // How much of the bar is full. If 100% the whole thing is full. If 0 everything is empty.
barWidth = 10 // Width of the bar. If 10 it's 10 characters long
emptyChars = "□" // Empty character to display for parts of the bar that aren't filled.
fullChars = "■" // Full character to display for parts of the bar that are filled.
returnAr = false // (optional) Return an array or not
firstEdgeOverride = ["◁", "◀"] // (optional) Overrides the first edge with the elements
lastEdgeOverride = ["▷", "▶"] // (optional) Overrides the last edge with elements
// This is exactly the same for class, but returnAr is not a parameter
let bar = new ProgressBar(percentage, barWidth, emptyChars, fullChars, firstEdgeOverride?, lastEdgeOverride?)
or if you don't want to deconstruct them (for some reason)
const pb = require("@yetnt/progressbar");
pb.progressBar();
// or
new pb.ProgressBar();
progressBar(45, 10, "□", "■");
let bar = new ProgressBar(45, 10, "□", "■");
bar.bar;
"■■■■□□□□□□";
progressBar(45, 10, "□", "■", true);
let bar = new ProgressBar(45, 10, "□", "■", true);
bar.barArray;
["■", "■", "■", "■", "□", "□", "□", "□", "□", "□"];
If you'd like you can also change the first bar element and the last bar element so you can edge it with emojis or something else.
["emptyChar", "filledChar"];
progressBar(56, 30, "▢", "▧", false, ["◁", "◀"], ["▷", "▶"]);
let bar = new ProgressBar(56, 30, "▢", "▧", ["◁", "◀"], ["▷", "▶"]);
bar.bar;
"◀▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▢▢▢▢▢▢▢▢▢▢▢▢▢▷";
The main difference between the function and the class (apart from one being a class and the other a function), is that when you update the barWidth/percentage properties in the class, the bar also updates.
let bar = new ProgressBar(56, 30, "▢", "▧", ["◁", "◀"], ["▷", "▶"]);
bar.bar; // ◀▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▢▢▢▢▢▢▢▢▢▢▢▢▢▷
bar.barWidth = 20;
bar.bar; // ◀▧▧▧▧▧▧▧▧▧▧▢▢▢▢▢▢▢▢▷
bar.percentage = 80;
bar.bar; // ◀▧▧▧▧▧▧▧▧▧▧▧▧▧▧▧▢▢▢▷
Warning : Bar may not work properly if you edit any other properties that aren't meant to be edited.
FAQs
An easy, simple and customizable string progress bar
The npm package @yetnt/progressbar receives a total of 0 weekly downloads. As such, @yetnt/progressbar popularity was classified as not popular.
We found that @yetnt/progressbar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.