新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
30 lines
958 B
JavaScript
30 lines
958 B
JavaScript
import isArrayLike from './_isArrayLike.js';
|
|
import values from './values.js';
|
|
import cb from './_cb.js';
|
|
import each from './each.js';
|
|
|
|
// Return the maximum element (or element-based computation).
|
|
export default function max(obj, iteratee, context) {
|
|
var result = -Infinity, lastComputed = -Infinity,
|
|
value, computed;
|
|
if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
|
|
obj = isArrayLike(obj) ? obj : values(obj);
|
|
for (var i = 0, length = obj.length; i < length; i++) {
|
|
value = obj[i];
|
|
if (value != null && value > result) {
|
|
result = value;
|
|
}
|
|
}
|
|
} else {
|
|
iteratee = cb(iteratee, context);
|
|
each(obj, function(v, index, list) {
|
|
computed = iteratee(v, index, list);
|
|
if (computed > lastComputed || (computed === -Infinity && result === -Infinity)) {
|
|
result = v;
|
|
lastComputed = computed;
|
|
}
|
|
});
|
|
}
|
|
return result;
|
|
}
|