SOURCE

// console.log(_.minBy([{age: 3}, {age: 2}], function(u) { return u.age; }));


var users = [
  { 'user': 'fred',   'age': 48 },
  { 'user': 'barney', 'age': 34 },
  { 'user': 'fred',   'age': 40 },
  { 'user': 'barney', 'age': 36 }
];
 
// 以 `user` 升序排序 再  `age` 以降序排序。
var name = _.orderBy(users, ['user', 'age'], ['asc']);

console.log(name)
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]


// 老数据id
oldArr = [1,3,5,7,9,2,4,6,8,0]

newArr = [1,2,8,3,4,0,7,9]

_.sortBy(newArr,(()=>{
    const hash = oldArr.reduce((s,n,idx)=>{
        s[n] = idx;
        return s;
    }, {})
    return (item)=>{
        return hash[item]
    }
})())
console 命令行工具 X clear

                    
>
console