(series)
| 19505 | } |
| 19506 | |
| 19507 | function insideOut(series) { |
| 19508 | var n = series.length, |
| 19509 | i, |
| 19510 | j, |
| 19511 | sums = series.map(sum), |
| 19512 | order = appearance(series), |
| 19513 | top = 0, |
| 19514 | bottom = 0, |
| 19515 | tops = [], |
| 19516 | bottoms = []; |
| 19517 | |
| 19518 | for (i = 0; i < n; ++i) { |
| 19519 | j = order[i]; |
| 19520 | if (top < bottom) { |
| 19521 | top += sums[j]; |
| 19522 | tops.push(j); |
| 19523 | } else { |
| 19524 | bottom += sums[j]; |
| 19525 | bottoms.push(j); |
| 19526 | } |
| 19527 | } |
| 19528 | |
| 19529 | return bottoms.reverse().concat(tops); |
| 19530 | } |
| 19531 | |
| 19532 | function reverse(series) { |
| 19533 | return none(series).reverse(); |
nothing calls this directly
no test coverage detected