min

math

Computes the minimum value of array. If array is empty or falsy, undefined is returned.

Signature

min<T extends number>(array: T[]): T | undefined

Parameters

NameTypeDescription
arrayT[]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:

2

Empty array

import { min } from 'dashlite'

const result = min([])
console.log(result)

Output:

undefined

Available since version 1.0.0