1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- var compareAscending = require('./_compareAscending');
- function compareMultiple(object, other, orders) {
- var index = -1,
- objCriteria = object.criteria,
- othCriteria = other.criteria,
- length = objCriteria.length,
- ordersLength = orders.length;
- while (++index < length) {
- var result = compareAscending(objCriteria[index], othCriteria[index]);
- if (result) {
- if (index >= ordersLength) {
- return result;
- }
- var order = orders[index];
- return result * (order == 'desc' ? -1 : 1);
- }
- }
-
-
-
-
-
-
-
- return object.index - other.index;
- }
- module.exports = compareMultiple;
|