@tldraw/utils
Advanced tools
Comparing version 2.0.0-alpha.6 to 2.0.0-alpha.7
@@ -24,2 +24,3 @@ "use strict"; | ||
last: () => last, | ||
minBy: () => minBy, | ||
rotateArray: () => rotateArray | ||
@@ -50,2 +51,14 @@ }); | ||
} | ||
function minBy(arr, fn) { | ||
let min; | ||
let minVal = Infinity; | ||
for (const item of arr) { | ||
const val = fn(item); | ||
if (val < minVal) { | ||
min = item; | ||
minVal = val; | ||
} | ||
} | ||
return min; | ||
} | ||
//# sourceMappingURL=array.js.map |
@@ -23,2 +23,14 @@ function rotateArray(arr, offset) { | ||
} | ||
function minBy(arr, fn) { | ||
let min; | ||
let minVal = Infinity; | ||
for (const item of arr) { | ||
const val = fn(item); | ||
if (val < minVal) { | ||
min = item; | ||
minVal = val; | ||
} | ||
} | ||
return min; | ||
} | ||
export { | ||
@@ -28,4 +40,5 @@ compact, | ||
last, | ||
minBy, | ||
rotateArray | ||
}; | ||
//# sourceMappingURL=array.js.map |
@@ -139,2 +139,4 @@ /* Excluded from this release type: annotateError */ | ||
/* Excluded from this release type: minBy */ | ||
/** | ||
@@ -141,0 +143,0 @@ * Modulate a value between two ranges. |
@@ -5,3 +5,3 @@ { | ||
"description": "A tiny little drawing app (private utilities).", | ||
"version": "2.0.0-alpha.6", | ||
"version": "2.0.0-alpha.7", | ||
"author": "tldraw GB Ltd.", | ||
@@ -8,0 +8,0 @@ "homepage": "https://tldraw.dev", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73997
1059