MCPcopy Create free account
hub / github.com/NathanPB/progress.js / bar

Function bar

src/token.ts:17–34  ·  view source on GitHub ↗
(
  { length, fill = '=', head = fill, empty = ' '}:
  { length: number, fill?: string, empty?: string, head?: string }
)

Source from the content-addressed store, hash-verified

15export type TokenDict = { [_: string]: Token }
16
17export const bar = (
18 { length, fill = '=', head = fill, empty = ' '}:
19 { length: number, fill?: string, empty?: string, head?: string }
20):Token => bar => {
21 const fillLength = Math.round(length * bar.progress())
22 return new Array(length)
23 .fill(1)
24 .map((_, idx) => {
25 if (idx < fillLength-1) {
26 return fill
27 } else if (idx === fillLength-1) {
28 return head
29 } else {
30 return empty
31 }
32 })
33 .join("")
34}
35
36export const elapsedTime = (
37 { interval = 1, until = Date.now, ...other }: { interval?: number, until?: ()=>number } & NumberFormat = {}

Callers

nothing calls this directly

Calls 1

progressMethod · 0.65

Tested by

no test coverage detected