({ n, count, method })
| 48 | } |
| 49 | |
| 50 | function main({ n, count, method }) { |
| 51 | const items = new Array(count); |
| 52 | let fn; |
| 53 | for (let i = 0; i < count; i++) |
| 54 | items[i] = i; |
| 55 | |
| 56 | switch (method) { |
| 57 | case 'for': |
| 58 | fn = useFor; |
| 59 | break; |
| 60 | case 'for-of': |
| 61 | fn = useForOf; |
| 62 | break; |
| 63 | case 'for-in': |
| 64 | fn = useForIn; |
| 65 | break; |
| 66 | case 'forEach': |
| 67 | fn = useForEach; |
| 68 | break; |
| 69 | default: |
| 70 | throw new Error(`Unexpected method "${method}"`); |
| 71 | } |
| 72 | fn(n, items, count); |
| 73 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…