UNPKG

diginext-utils

Version:
18 lines 595 B
/** * Finds the minimum value in an array. * If a key is provided, finds the minimum value of that property from each object. * * @template T - The type of elements in the array * @param array - The array to search * @param key - Optional key to find minimum value from objects * @returns The minimum value, or 0 if array is empty * * @example * ```ts * min([3, 1, 4, 1, 5]); // 1 * min([{ value: 5 }, { value: 2 }, { value: 8 }], 'value'); // 2 * min([]); // 0 * ``` */ export declare function min<T = number>(array: T[], key?: keyof T): number; //# sourceMappingURL=min.d.ts.map