how to group and Separate object of an array that comes from the server. array like this:
(MOVINGSTATE s This means that Stop andm moving. XPOINT and YPOINT This means that latitude and longitude of car.)
[{MOVINGSTATE: "s",XPOINT:53.9172866,YPOINT: 26.518275},
{MOVINGSTATE: "s",XPOINT: 53.9172866,YPOINT: 26.518275},
{MOVINGSTATE: "m",XPOINT: 54.0215383,YPOINT: 26.5275599},
{MOVINGSTATE: "m",XPOINT: 54.0102666,YPOINT: 26.4989583},
{MOVINGSTATE: "s",XPOINT: 54.0016599,YPOINT: 26.5478316},..]
I want to if some MOVINGSTATE Continuous s goto new array and when MOVINGSTATE change to mgoto new array and again MOVINGSTATEchange to s goto new array. all this new array object of another main array.
i use loadash
var aaa = _loadash.groupBy(props,'MOVINGSTATE')
but Output this :
{m:Array(2),s:Array(3)}
i want outpust like this:
[
[
{MOVINGSTATE: "s",XPOINT:53.9172866,YPOINT: 26.518275},
{MOVINGSTATE: "s",XPOINT: 53.9172866,YPOINT: 26.518275}
],
[
{MOVINGSTATE: "m",XPOINT: 54.0215383,YPOINT: 26.5275599},
{MOVINGSTATE: "m",XPOINT: 54.0102666,YPOINT: 26.4989583}
],
[
{MOVINGSTATE: "s",XPOINT: 54.0016599,YPOINT: 26.5478316}
]
]
how to this thanks for helping