【发布时间】:2016-04-13 18:00:03
【问题描述】:
我正在使用v4.11.0。
我想根据milliseconds 属性对对象进行排序。
这是数组:
[
{
"name": "bug12755.xml",
"list": "bugs42",
"start-date": "2015-09-14",
"age": {
"text": "7 months",
"milliseconds": 18381227304
}
},
{
"name": "bug12922.xml",
"list": "bugs42",
"start-date": "2015-08-27",
"age": {
"text": "8 months",
"milliseconds": 19936427304
}
},
{
"name": "bug13183.xml",
"list": "bugs50",
"start-date": "2015-08-27",
"age": {
"text": "8 months",
"milliseconds": 19936427305
}
}
]
我缺少关于 iteratee 函数的一些基本内容。我有这个,但似乎没有对数组进行排序。提前致谢!
_.orderBy(list, function(item) {
return item.age.value;
}, ['desc']);
【问题讨论】:
标签: lodash