es-toolkit 1.37.2-dev.1269 → 1.37.2-dev.1270
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.js +24 -16
- package/dist/compat/math/max.d.mts +2 -2
- package/dist/compat/math/max.d.ts +2 -2
- package/dist/compat/math/max.mjs +12 -8
- package/dist/compat/math/min.d.mts +2 -2
- package/dist/compat/math/min.d.ts +2 -2
- package/dist/compat/math/min.mjs +12 -8
- package/package.json +1 -1
package/dist/compat/index.js
CHANGED
|
@@ -2634,17 +2634,21 @@ function inRange(value, minimum, maximum) {
|
|
|
2634
2634
|
return range$1.inRange(value, minimum, maximum);
|
|
2635
2635
|
}
|
|
2636
2636
|
|
|
2637
|
-
function max(items
|
|
2638
|
-
|
|
2639
|
-
|
|
2637
|
+
function max(items) {
|
|
2638
|
+
if (!items || items.length === 0) {
|
|
2639
|
+
return undefined;
|
|
2640
|
+
}
|
|
2641
|
+
let maxResult = undefined;
|
|
2640
2642
|
for (let i = 0; i < items.length; i++) {
|
|
2641
|
-
const
|
|
2642
|
-
if (
|
|
2643
|
-
|
|
2644
|
-
|
|
2643
|
+
const current = items[i];
|
|
2644
|
+
if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
|
|
2645
|
+
continue;
|
|
2646
|
+
}
|
|
2647
|
+
if (maxResult === undefined || current > maxResult) {
|
|
2648
|
+
maxResult = current;
|
|
2645
2649
|
}
|
|
2646
2650
|
}
|
|
2647
|
-
return
|
|
2651
|
+
return maxResult;
|
|
2648
2652
|
}
|
|
2649
2653
|
|
|
2650
2654
|
function maxBy(items, iteratee$1) {
|
|
@@ -2692,17 +2696,21 @@ function meanBy(items, iteratee$1) {
|
|
|
2692
2696
|
return range$1.meanBy(Array.from(items), iteratee(iteratee$1));
|
|
2693
2697
|
}
|
|
2694
2698
|
|
|
2695
|
-
function min(items
|
|
2696
|
-
|
|
2697
|
-
|
|
2699
|
+
function min(items) {
|
|
2700
|
+
if (!items || items.length === 0) {
|
|
2701
|
+
return undefined;
|
|
2702
|
+
}
|
|
2703
|
+
let minResult = undefined;
|
|
2698
2704
|
for (let i = 0; i < items.length; i++) {
|
|
2699
|
-
const
|
|
2700
|
-
if (
|
|
2701
|
-
|
|
2702
|
-
|
|
2705
|
+
const current = items[i];
|
|
2706
|
+
if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
|
|
2707
|
+
continue;
|
|
2708
|
+
}
|
|
2709
|
+
if (minResult === undefined || current < minResult) {
|
|
2710
|
+
minResult = current;
|
|
2703
2711
|
}
|
|
2704
2712
|
}
|
|
2705
|
-
return
|
|
2713
|
+
return minResult;
|
|
2706
2714
|
}
|
|
2707
2715
|
|
|
2708
2716
|
function minBy(items, iteratee$1) {
|
|
@@ -22,9 +22,9 @@ declare function max(): undefined;
|
|
|
22
22
|
* Finds the element in an array that has the maximum value.
|
|
23
23
|
*
|
|
24
24
|
* @template T - The type of elements in the array.
|
|
25
|
-
* @param {T
|
|
25
|
+
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
|
|
26
26
|
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
|
|
27
27
|
*/
|
|
28
|
-
declare function max<T>(items?:
|
|
28
|
+
declare function max<T>(items?: ArrayLike<T> | null | undefined): T | undefined;
|
|
29
29
|
|
|
30
30
|
export { max };
|
|
@@ -22,9 +22,9 @@ declare function max(): undefined;
|
|
|
22
22
|
* Finds the element in an array that has the maximum value.
|
|
23
23
|
*
|
|
24
24
|
* @template T - The type of elements in the array.
|
|
25
|
-
* @param {T
|
|
25
|
+
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
|
|
26
26
|
* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty.
|
|
27
27
|
*/
|
|
28
|
-
declare function max<T>(items?:
|
|
28
|
+
declare function max<T>(items?: ArrayLike<T> | null | undefined): T | undefined;
|
|
29
29
|
|
|
30
30
|
export { max };
|
package/dist/compat/math/max.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
function max(items
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function max(items) {
|
|
2
|
+
if (!items || items.length === 0) {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
let maxResult = undefined;
|
|
4
6
|
for (let i = 0; i < items.length; i++) {
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const current = items[i];
|
|
8
|
+
if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (maxResult === undefined || current > maxResult) {
|
|
12
|
+
maxResult = current;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
|
-
return
|
|
15
|
+
return maxResult;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
export { max };
|
|
@@ -23,9 +23,9 @@ declare function min(): undefined;
|
|
|
23
23
|
* Finds the element in an array that has the minimum value.
|
|
24
24
|
*
|
|
25
25
|
* @template T - The type of elements in the array.
|
|
26
|
-
* @param {T
|
|
26
|
+
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
|
|
27
27
|
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
|
|
28
28
|
*/
|
|
29
|
-
declare function min<T>(items?:
|
|
29
|
+
declare function min<T>(items?: ArrayLike<T> | null | undefined): T | undefined;
|
|
30
30
|
|
|
31
31
|
export { min };
|
|
@@ -23,9 +23,9 @@ declare function min(): undefined;
|
|
|
23
23
|
* Finds the element in an array that has the minimum value.
|
|
24
24
|
*
|
|
25
25
|
* @template T - The type of elements in the array.
|
|
26
|
-
* @param {T
|
|
26
|
+
* @param {ArrayLike<T> | null | undefined} [items] - The array of elements to search. Defaults to an empty array.
|
|
27
27
|
* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty.
|
|
28
28
|
*/
|
|
29
|
-
declare function min<T>(items?:
|
|
29
|
+
declare function min<T>(items?: ArrayLike<T> | null | undefined): T | undefined;
|
|
30
30
|
|
|
31
31
|
export { min };
|
package/dist/compat/math/min.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
function min(items
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function min(items) {
|
|
2
|
+
if (!items || items.length === 0) {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
let minResult = undefined;
|
|
4
6
|
for (let i = 0; i < items.length; i++) {
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const current = items[i];
|
|
8
|
+
if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (minResult === undefined || current < minResult) {
|
|
12
|
+
minResult = current;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
|
-
return
|
|
15
|
+
return minResult;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
export { min };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.37.2-dev.
|
|
4
|
+
"version": "1.37.2-dev.1270+712176c8",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|