minBy (関数型プログラミング)
計算されたスコアが最小の値を返す関数を作成します。関数型プログラミングの pipe と一緒に使用します。
typescript
const result = pipe(array, minBy(getValue));使用法
minBy はパイプされた配列の各値に getValue を呼び出し、その結果が最小の値を返します。配列が空の場合は undefined を返します。
typescript
import { minBy, pipe } from 'es-toolkit/fp';
pipe(
[{ score: 10 }, { score: 30 }, { score: 20 }],
minBy(item => item.score)
); // => { score: 10 }パラメータ
getValue((item: T) => number): 比較に使う値を返す関数です。
戻り値
((array: readonly T[]) => T | undefined): readonly T[] を最小の項目、または undefined に変換する関数です。

