在 WebStorm 中,ESLint 库发誓并给出错误
TypeError:比较函数必须是函数或未定义
我单击详细信息,我看到链接转到了这样的功能:
function getAcceptableSlots(memberInfo, orderedSlots) {
return orderedSlots.map(function (slot, index) {
return { index: index, score: scoreMember(memberInfo, slot), sort: slot.sort };
}) // check member against each slot
.filter(function (_ref3) {
var score = _ref3.score;
return score > 0;
}) // discard slots that don't match
.sort(function (a, b) {
return b.score - a.score;
}) // sort best matching slots first
.filter(function (_ref4, i, array) {
var score = _ref4.score;
return score === array[0].score;
}) // take top scoring slots
.sort('index');
}
具体来说,它发誓 .sort('index');
有谁知道它可能是什么以及如何解决它?