muse/src/utils/get-progress-bar.ts
2020-03-18 22:29:43 -05:00

16 lines
279 B
TypeScript

export default (width: number, progress: number): string => {
const dotPosition = Math.floor(width * progress);
let res = '';
for (let i = 0; i < width; i++) {
if (i === dotPosition) {
res += '🔘';
} else {
res += '▬';
}
}
return res;
};