Allow sortBy to handle undefined values.

This commit is contained in:
Chris Baynes
2012-03-31 11:05:47 +02:00
parent 00ed5d70c8
commit e4c4300a06

View File

@@ -270,6 +270,8 @@
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
if (_.isUndefined(a)) return 1;
if (_.isUndefined(b)) return -1;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};