Appearance
计算数组中的最大值。如果数组为空或假值,则返回 undefined。
import { maxBy } from '@base-web-kits/base-tools-ts'; const objects = [{ n: 1 }, { n: 2 }]; maxBy(objects, (o) => o.n); // 结果: { 'n': 2 }
array (Array)
iteratee (Function)
(T | undefined)