min
mathComputes the minimum value of array. If array is empty or falsy, undefined is returned.
Signature
min<T extends number>(array: T[]): T | undefinedParameters
| Name | Type | Description |
|---|---|---|
array | T[] | The array to iterate over |
Returns
T | undefined - Returns the minimum value
Examples
Basic usage
import { min } from 'dashlite'
const result = min([4, 2, 8, 6])
console.log(result)Output:
2Empty array
import { min } from 'dashlite'
const result = min([])
console.log(result)Output:
undefinedAvailable since version 1.0.0