Gived a list
[
{id:'i1',value:'v1'},
{id:'i3',value:'v3'},
{id:'i4',value:'v4'},
{id:'i2',value:'v2'},
{id:'i5',value:'v5'},
]
and another ordered id list
['i1','i2','i3','i4','i5']
get
[
{id:'i1',value:'v1'},
{id:'i2',value:'v2'},
{id:'i3',value:'v3'},
{id:'i4',value:'v4'},
{id:'i5',value:'v5'},
]
How to do this in lodash?
id. Actually the data list is queried by id list from server. But the server can't promise the order of data will not be changed so I need to sort the data manually.