source: trip-planner-front/node_modules/lodash/_baseExtremum.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 897 bytes
RevLine 
[6a3a178]1var isSymbol = require('./isSymbol');
2
3/**
4 * The base implementation of methods like `_.max` and `_.min` which accepts a
5 * `comparator` to determine the extremum value.
6 *
7 * @private
8 * @param {Array} array The array to iterate over.
9 * @param {Function} iteratee The iteratee invoked per iteration.
10 * @param {Function} comparator The comparator used to compare values.
11 * @returns {*} Returns the extremum value.
12 */
13function baseExtremum(array, iteratee, comparator) {
14 var index = -1,
15 length = array.length;
16
17 while (++index < length) {
18 var value = array[index],
19 current = iteratee(value);
20
21 if (current != null && (computed === undefined
22 ? (current === current && !isSymbol(current))
23 : comparator(current, computed)
24 )) {
25 var computed = current,
26 result = value;
27 }
28 }
29 return result;
30}
31
32module.exports = baseExtremum;
Note: See TracBrowser for help on using the repository browser.