source: trip-planner-front/node_modules/lodash/_compareAscending.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1var isSymbol = require('./isSymbol');
2
3/**
4 * Compares values to sort them in ascending order.
5 *
6 * @private
7 * @param {*} value The value to compare.
8 * @param {*} other The other value to compare.
9 * @returns {number} Returns the sort order indicator for `value`.
10 */
11function compareAscending(value, other) {
12 if (value !== other) {
13 var valIsDefined = value !== undefined,
14 valIsNull = value === null,
15 valIsReflexive = value === value,
16 valIsSymbol = isSymbol(value);
17
18 var othIsDefined = other !== undefined,
19 othIsNull = other === null,
20 othIsReflexive = other === other,
21 othIsSymbol = isSymbol(other);
22
23 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
24 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
25 (valIsNull && othIsDefined && othIsReflexive) ||
26 (!valIsDefined && othIsReflexive) ||
27 !valIsReflexive) {
28 return 1;
29 }
30 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
31 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
32 (othIsNull && valIsDefined && valIsReflexive) ||
33 (!othIsDefined && valIsReflexive) ||
34 !othIsReflexive) {
35 return -1;
36 }
37 }
38 return 0;
39}
40
41module.exports = compareAscending;
Note: See TracBrowser for help on using the repository browser.