main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
612 bytes
|
Line | |
---|
1 | import baseExtremum from './_baseExtremum.js';
|
---|
2 | import baseLt from './_baseLt.js';
|
---|
3 | import identity from './identity.js';
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Computes the minimum value of `array`. If `array` is empty or falsey,
|
---|
7 | * `undefined` is returned.
|
---|
8 | *
|
---|
9 | * @static
|
---|
10 | * @since 0.1.0
|
---|
11 | * @memberOf _
|
---|
12 | * @category Math
|
---|
13 | * @param {Array} array The array to iterate over.
|
---|
14 | * @returns {*} Returns the minimum value.
|
---|
15 | * @example
|
---|
16 | *
|
---|
17 | * _.min([4, 2, 8, 6]);
|
---|
18 | * // => 2
|
---|
19 | *
|
---|
20 | * _.min([]);
|
---|
21 | * // => undefined
|
---|
22 | */
|
---|
23 | function min(array) {
|
---|
24 | return (array && array.length)
|
---|
25 | ? baseExtremum(array, identity, baseLt)
|
---|
26 | : undefined;
|
---|
27 | }
|
---|
28 |
|
---|
29 | export default min;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.