muse/src/utils/get-progress-bar.ts

16 lines
279 B
TypeScript
Raw Normal View History

2020-03-19 04:29:43 +01:00
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;
};