9 lines
460 B
TypeScript
9 lines
460 B
TypeScript
// Building copies: the server sends each instance's `instance_share` (1 for the first of a
|
|
// type, 0.5, 0.25, … for the copies); the client only shows it as a percentage.
|
|
|
|
/** A copy works below full output. Missing shares (older servers) count as full. */
|
|
export const isCopy = (share: number | undefined) => share !== undefined && share < 1
|
|
|
|
/** 0.5 → 50, 0.125 → 12.5. */
|
|
export const sharePercent = (share: number) => Math.round(share * 1000) / 10
|