title: Chunk array based on conditional logic using ramda
body: <p>I have an array of sizes that I’d like to reduce + chunk based on custom logic using ramda:</p>
  <pre><code>const sizes = [
    { size: 30 },
    { size: 10 },
    { size: 40 },
    { size: 20 },
    { size: 20 },
  ];
  </code></pre>
  <p>If the cumulative total exceeds the <code>50</code> threshold I would like to chunk them up, so that the result becomes:</p>
  <pre><code>const threshold = 50;
  
  // 30 + 10 &lt;= 50
  // 40 &lt;= 50
  // 20 + 20 &lt;= 50
  
  const result = [40, 40, 40];
  </code></pre>
  <p>I’ve tried using <code>reduceWhile</code> and <code>splitWhen</code> but with no luck so far</p>