Is there a way to convert this into an array of objects that are ordered based on another array's keys?
{
tom: 11,
jim: 22,
jay: 13
}
Here are some input -> output examples:
['jim', 'tom', 'kim', 'jay']
->
[{jim: 22}, {tom: 11}, {jay: 13}]
['may', 'jay', 'tom', 'jim']
->
[{jay: 13}, {tom: 11}, {jim: 22}]
I am looking for a solution, preferably using a one-liner in lodash. How can I achieve this transformation?