Merge pull request #534 from chris-baynes/master

Allow for better handling of undefined values in sortBy.
This commit is contained in:
Jeremy Ashkenas
2012-04-02 10:13:04 -07:00

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');
};