compareAscending.js 548 B

12345678910111213141516
  1. var baseCompareAscending = require('./baseCompareAscending');
  2. /**
  3. * Used by `_.sortBy` to compare transformed elements of a collection and stable
  4. * sort them in ascending order.
  5. *
  6. * @private
  7. * @param {Object} object The object to compare.
  8. * @param {Object} other The other object to compare.
  9. * @returns {number} Returns the sort order indicator for `object`.
  10. */
  11. function compareAscending(object, other) {
  12. return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
  13. }
  14. module.exports = compareAscending;