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
564 B
Text
21 lines
564 B
Text
/**
|
|
* This follows https://tc39.es/ecma402/#sec-case-sensitivity-and-case-mapping
|
|
* @param str string to convert
|
|
*/
|
|
function toUpperCase(str) {
|
|
return str.replace(/([a-z])/g, function (_, c) { return c.toUpperCase(); });
|
|
}
|
|
var NOT_A_Z_REGEX = /[^A-Z]/;
|
|
/**
|
|
* https://tc39.es/ecma402/#sec-iswellformedcurrencycode
|
|
*/
|
|
export function IsWellFormedCurrencyCode(currency) {
|
|
currency = toUpperCase(currency);
|
|
if (currency.length !== 3) {
|
|
return false;
|
|
}
|
|
if (NOT_A_Z_REGEX.test(currency)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|