UNPKG

442 BJavaScriptView Raw
1// format bar
2module.exports = function formatBar(progress, options){
3 // calculate barsize
4 const completeSize = Math.round(progress*options.barsize);
5 const incompleteSize = options.barsize-completeSize;
6
7 // generate bar string by stripping the pre-rendered strings
8 return options.barCompleteString.substr(0, completeSize) +
9 options.barGlue +
10 options.barIncompleteString.substr(0, incompleteSize);
11}
\No newline at end of file