max.d.ts 444 B

12345678910111213141516171819
  1. declare const _default: (arr: number[]) => number | undefined;
  2. /**
  3. * @param {Array} arr The array to iterate over.
  4. * @return {*} Returns the maximum value.
  5. * @example
  6. *
  7. * max([1, 2]);
  8. * // => 2
  9. *
  10. * max([]);
  11. * // => undefined
  12. *
  13. * const data = new Array(1250010).fill(1).map((d,idx) => idx);
  14. *
  15. * max(data);
  16. * // => 1250010
  17. * // Math.max(...data) will encounter "Maximum call stack size exceeded" error
  18. */
  19. export default _default;