function pgn(obj, num) { return obj.reduce(function (a, b, i) { if(i % num === 0) a.push({}); a[a.length-1][i] = b; return a; }, []); }