I have the an array of objects similar to this:
[
  {
    name: 'Apple',
    colors: ['red', 'green', 'yellow']
  },
  {
    name: 'Orange',
    colors: ['orange']
  }
]
I would like to shuffle the colors of each object. I am currently using the following code:
_.each(fruits, function (elem) {
  elem.colors = _.shuffle(elem.colors);
});
However, this code does not work with chaining, turns colors into an object, and requires an anonymous function that I think could be eliminated. Is there any way to make this code simpler?
 
     
    