Good day everyone. A cheerful api comes to me with a strict number of keys, 720, each of which consists of a set of values:
0: object x : 0 y : 1 z : 2 time : "2017-03-09T07:00:00+03:00" 1: object x : 0 y : 1 z : 2 time : "2017-03-09T07:00:02+03:00" ... [720] I need to consistently from the zero key to glue every 5 to a new one. As a result, you need to get 144 pieces, respectively, the time key in each new object should be 00:00 ; 01:00 ; 02:00 00:00 ; 01:00 ; 02:00
I pounded them forEach and _.each and maybe I’ve already gotten dirty, ask for help, send me, otherwise I don’t see where to go.
Example: what we have:
0 [x:1, y:1, z:0, time: 00:00] 1 [x:2, y:2, z:4, time: 00:02] 2 [x:3, y:3, z:6, time: 00:04] 3 [x:0, y:0, z:0, time: 00:06] 4 [x:0, y:0, z:0, time: 00:08] ...720 the output is the result of the addition of the first five:
0 [x:6, y:6, z:10, time:00:00] the next iteration glues the next 5 pieces to the end
1 [x:number, y:number, z:number, time: 00:10] 2 [x:number, y:number, z:number, time: 00:20] ...144
timeto do a string, if you can make an array? Is it implied that the values ofx,y,zsame for every five, or how to glue? - teran