f2b7657fb968fe5de92359394b4dbccacb526cc4
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * The base implementation of `compareAscending` which compares values and
3  * sorts them in ascending order without guaranteeing a stable sort.
4  *
5  * @private
6  * @param {*} value The value to compare to `other`.
7  * @param {*} other The value to compare to `value`.
8  * @returns {number} Returns the sort order indicator for `value`.
9  */
10 function baseCompareAscending(value, other) {
11   if (value !== other) {
12     var valIsReflexive = value === value,
13         othIsReflexive = other === other;
14
15     if (value > other || !valIsReflexive || (value === undefined && othIsReflexive)) {
16       return 1;
17     }
18     if (value < other || !othIsReflexive || (other === undefined && valIsReflexive)) {
19       return -1;
20     }
21   }
22   return 0;
23 }
24
25 module.exports = baseCompareAscending;