mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
/**
|
|
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
|
* Build: `lodash modern modularize exports="npm" -o ./`
|
|
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
|
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
|
|
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
* Available under MIT license <https://lodash.com/license>
|
|
*/
|
|
|
|
/**
|
|
* The base implementation of `compareAscending` which compares values and
|
|
* sorts them in ascending order without guaranteeing a stable sort.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare to `other`.
|
|
* @param {*} other The value to compare to `value`.
|
|
* @returns {number} Returns the sort order indicator for `value`.
|
|
*/
|
|
function baseCompareAscending(value, other) {
|
|
if (value !== other) {
|
|
var valIsReflexive = value === value,
|
|
othIsReflexive = other === other;
|
|
|
|
if (value > other || !valIsReflexive || (typeof value == 'undefined' && othIsReflexive)) {
|
|
return 1;
|
|
}
|
|
if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) {
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
module.exports = baseCompareAscending;
|