Gruntfile.js
function groupToElements(array, n) {
  var lists = _.groupBy(array, function(element, index){
    return Math.floor(index / n);
  });

  return _.toArray(lists);
}
function groupToElements(array, n) {
  var lists = _.groupBy(array, function(element, index){
    return Math.floor(index / n);
  });

  return _.toArray(lists);
}
function groupToElements ( array , n ) { var lists = _ . groupBy ( array , function ( element , index ) { return Math . floor ( index / n ) ; } ) ; return _ . toArray ( lists ) ; }
Split array to smaller arrays containing n elements at max
Split array to smaller arrays containing n elements at max