CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
meanBy.d.ts19 linesDownload Raw Back to math
1/**2 * Calculates the average of an array of numbers when applying3 * the `getValue` function to each element.4 *5 * If the array is empty, this function returns `NaN`.6 *7 * @template T - The type of elements in the array.8 * @param {T[]} items An array to calculate the average.9 * @param {(element: T) => number} getValue A function that selects a numeric value from each element.10 * @returns {number} The average of all the numbers as determined by the `getValue` function.11 *12 * @example13 * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 214 * meanBy([], x => x.a); // Returns: NaN15 */16declare function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number;17 18export { meanBy };19 
basant307/AI_Governance_Project · CoolFace