I have 2 arrays
a = [ { label:"Price", value:10 }, { label:"Active", value:false }, { label:"Category", value:"food" }, { label:"Remarks", value:"none" } ]; b = ["Active","Category","Price"];
How do I sort a according to the order of b? Can I use ramda?
Something succinct like the following would be ideal
R.sortBy(R.pipe(R.prop('label'), R.indexOf(R.__, a)))(b);
Similar to this issue, except I don't have index, so I cannot use indexOf method.
Sort an array of objects based on another array of ids
Appreciate your help!