Skip to content

Commit 7c3167d

Browse files
committed
fix no set total case
1 parent 20c4d8f commit 7c3167d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Progress = {
3434
index: 0, total: 0, text: '',
3535
toString (percent) {
3636
if (this.total) return percent = Math.ceil(this.index * 100) / this.total, Progress.option.index = '(' + this.index + '/' + this.total + ')', [Progress.option.index, (Progress.option.percent = parseInt(percent <= 100 ? percent >= 0 ? percent : 0 : 100, 10) + '%', Progress.option.percent), this.text].filter(t => t !== '').join(' ' + Progress.option.dash + ' ')
37-
return ' ' + Progress.option.dash + ' ' + this.text.toString()
37+
return this.text !== '' ? ' ' + Progress.option.dash + ' ' + this.text.toString() : ''
3838
},
3939
appendTo(lines) {
4040
if (lines.length) return [...lines].map(({ index, space, str }) => ['\x1b[K', ' '.repeat(Progress.option.space), index ? space + ' ' + Progress.option.newline : Progress.option.header, ' ', index ? (Progress.option.subtitle = str, Progress.option.subtitle) : (Progress.option.title = str, Progress.option.title), index ? '' : this].join('')).join("\n")

0 commit comments

Comments
 (0)