Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
672 B
Text
29 lines
672 B
Text
import ascending from "./ascending.js";
|
|
|
|
export default function least(values, compare = ascending) {
|
|
let min;
|
|
let defined = false;
|
|
if (compare.length === 1) {
|
|
let minValue;
|
|
for (const element of values) {
|
|
const value = compare(element);
|
|
if (defined
|
|
? ascending(value, minValue) < 0
|
|
: ascending(value, value) === 0) {
|
|
min = element;
|
|
minValue = value;
|
|
defined = true;
|
|
}
|
|
}
|
|
} else {
|
|
for (const value of values) {
|
|
if (defined
|
|
? compare(value, min) < 0
|
|
: compare(value, value) === 0) {
|
|
min = value;
|
|
defined = true;
|
|
}
|
|
}
|
|
}
|
|
return min;
|
|
}
|