Loadash Sort por orden de otra matriz

var firstArray = ['asdf12','39342aa','12399','129asg',...];

// a collection which has these keys in each object like so:
var collection = [{guid: '39342aa', name: 'John'},{guid: '129asg', name: 'Mary'}, ... ];

const last = collection.length;

var sortedCollection = _.sortBy(collection, function(item){
  return firstArray.indexOf(item.guid) !== -1
  	? firstArray.indexOf(item.guid) : last;
});
Obedient Oyster