MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / baseCompare

Function baseCompare

06.Router/basic/js/vue.js:9713–9724  ·  view source on GitHub ↗
(a, b, sortKeyIndex)

Source from the content-addressed store, hash-verified

9711 }
9712
9713 function baseCompare(a, b, sortKeyIndex) {
9714 var sortKey = sortKeys[sortKeyIndex];
9715 if (sortKey) {
9716 if (sortKey !== '$key') {
9717 if (isObject(a) && '$value' in a) a = a.$value;
9718 if (isObject(b) && '$value' in b) b = b.$value;
9719 }
9720 a = isObject(a) ? getPath(a, sortKey) : a;
9721 b = isObject(b) ? getPath(b, sortKey) : b;
9722 }
9723 return a === b ? 0 : a > b ? order : -order;
9724 }
9725
9726 // sort on a copy to avoid mutating original array
9727 return arr.slice().sort(comparator);

Callers 1

orderByFunction · 0.70

Calls 2

isObjectFunction · 0.70
getPathFunction · 0.70

Tested by

no test coverage detected