2

When I try this in Ramda I get an Illegal Invocation exception:

var arr = R.map(r.rows.item, R.range(0, r.rows.length));

I can do it in two lines but then it seems even more of a hack:

var i = 0;
var arr = R.repeatN(null, r.rows.length).map( function() { return r.rows.item(i++); } );

What is the preferred method of accomplishing this? Should I stick with a loop instead?

ilitirit
  • 16,016
  • 18
  • 72
  • 111

1 Answers1

1

this should do it:

var rowArray = R.map.idx(function(row, i) { return r.rows.item(i); }, r.rows);

That should map each row object into the output array rowArray.