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>
21 lines
557 B
Text
21 lines
557 B
Text
/**
|
|
* https://tc39.es/ecma402/#sec-bestavailablelocale
|
|
* @param availableLocales
|
|
* @param locale
|
|
*/
|
|
export function BestAvailableLocale(availableLocales, locale) {
|
|
var candidate = locale;
|
|
while (true) {
|
|
if (availableLocales.indexOf(candidate) > -1) {
|
|
return candidate;
|
|
}
|
|
var pos = candidate.lastIndexOf('-');
|
|
if (!~pos) {
|
|
return undefined;
|
|
}
|
|
if (pos >= 2 && candidate[pos - 2] === '-') {
|
|
pos -= 2;
|
|
}
|
|
candidate = candidate.slice(0, pos);
|
|
}
|
|
}
|