I have this sort of data, which we usually grab from api, and it is my first time using lodash.
{
"_id": "93866",
"stats": [
{
"points": 86,
"pos": 11,
"createdAt": "2019-01-16T10:13:40.650Z",
"updatedAt": "2019-01-16T10:13:40.825Z"
},
{
"points": 79,
"pos": 26,
"createdAt": "2019-01-16T10:13:40.650Z",
"updatedAt": "2019-01-16T10:13:40.825Z"
},
{
"points": 64,
"pos": 39,
"createdAt": "2019-01-16T10:13:40.650Z",
"updatedAt": "2019-01-16T10:13:40.825Z"
}
]
}
All I want is to achieve like this
[ [ 86, 11 ], [ 79, 26 ], [ 64, 39 ] ]
I can simply do this in a native way by doing this,
var result = data.stats.map(o => [o.points, o.pos])
// => [ [ 86, 11 ], [ 79, 26 ], [ 64, 39 ] ]
which yields the expected result but the environment I'm working depends on the use of lodash.
I have tried so far _.map(data.stats, 'points') but Im not sure how I make it to achieve like this [ [ 86, 11 ], [ 79, 26 ], [ 64, 39 ] ]
So how to do it?