Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

max.js 614B

1234567891011121314151617181920212223242526272829
  1. var baseExtremum = require('./_baseExtremum'),
  2. baseGt = require('./_baseGt'),
  3. identity = require('./identity');
  4. /**
  5. * Computes the maximum value of `array`. If `array` is empty or falsey,
  6. * `undefined` is returned.
  7. *
  8. * @static
  9. * @since 0.1.0
  10. * @memberOf _
  11. * @category Math
  12. * @param {Array} array The array to iterate over.
  13. * @returns {*} Returns the maximum value.
  14. * @example
  15. *
  16. * _.max([4, 2, 8, 6]);
  17. * // => 8
  18. *
  19. * _.max([]);
  20. * // => undefined
  21. */
  22. function max(array) {
  23. return (array && array.length)
  24. ? baseExtremum(array, identity, baseGt)
  25. : undefined;
  26. }
  27. module.exports = max;