source: node_modules/es-toolkit/dist/compat/math/max.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 475 bytes
RevLine 
[a762898]1function max(items) {
2 if (!items || items.length === 0) {
3 return undefined;
4 }
5 let maxResult = undefined;
6 for (let i = 0; i < items.length; i++) {
7 const current = items[i];
8 if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
9 continue;
10 }
11 if (maxResult === undefined || current > maxResult) {
12 maxResult = current;
13 }
14 }
15 return maxResult;
16}
17
18export { max };
Note: See TracBrowser for help on using the repository browser.