Given the following array:
var arr = [{id:1 , code:0},
{id:1 , code:12},
{id:1 , code:0},
{id:1 , code:0},
{id:1 , code:5}];
How can I use lodash, to split the array each time code is not equal to 0 and get the following results?
[
[{id:1 , code:0},{id:1 , code:12}],
[{id:1 , code:0},{id:1 , code:0},{id:1 , code:5}]
]
Aucun commentaire:
Enregistrer un commentaire