Files
openclaw 0a5f6a8047 Initial commit: Lan-manager project code
- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs

Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
2026-04-20 00:52:58 +08:00

27 lines
614 B
JavaScript

import isArray from './is-array';
/**
* @param {Array} arr The array to iterate over.
* @return {*} Returns the maximum value.
* @example
*
* max([1, 2]);
* // => 2
*
* max([]);
* // => undefined
*
* const data = new Array(1250010).fill(1).map((d,idx) => idx);
*
* max(data);
* // => 1250010
* // Math.max(...data) will encounter "Maximum call stack size exceeded" error
*/
export default (function (arr) {
if (!isArray(arr)) {
return undefined;
}
return arr.reduce(function (prev, curr) {
return Math.max(prev, curr);
}, arr[0]);
});
//# sourceMappingURL=max.js.map