(count: number, factory: object | (() => any))
| 25 | } |
| 26 | |
| 27 | export function makeData(count: number, factory: object | (() => any)): any[] { |
| 28 | return Array.from({ length: count }, () => { |
| 29 | // clone non primitive data |
| 30 | if (typeof factory === "object") return { ...factory }; |
| 31 | if (typeof factory === "function") return factory(); |
| 32 | throw new Error("Invalid factory"); |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | export function formatNumber(val: number): string { |
| 37 | if (val >= 1e12) { |
no outgoing calls
no test coverage detected