Files
NapCatQQ/.pnpm-store/v3/files/fe/d70c5a3e937ee459362e196c2caf7b3d33b8c0e181600d2d52bd416f1d65d643ba4d6b44d06aa76fff52a45fefb4e6a369ec370f595a81b3bd6c0a7a5bca68
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

35 lines
989 B
Plaintext

import baseExtremum from './_baseExtremum.js';
import baseIteratee from './_baseIteratee.js';
import baseLt from './_baseLt.js';
/**
* This method is like `_.min` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the criterion by which
* the value is ranked. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
* var objects = [{ 'n': 1 }, { 'n': 2 }];
*
* _.minBy(objects, function(o) { return o.n; });
* // => { 'n': 1 }
*
* // The `_.property` iteratee shorthand.
* _.minBy(objects, 'n');
* // => { 'n': 1 }
*/
function minBy(array, iteratee) {
return (array && array.length)
? baseExtremum(array, baseIteratee(iteratee, 2), baseLt)
: undefined;
}
export default minBy;