📅  最后修改于: 2022-03-11 15:02:56.237000             🧑  作者: Mango
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;
});