Rocky_Mountain_Vending/.pnpm-store/v10/files/1e/203469c7c290f1d2df9daf6876348bda0e62ba15d4393ff91864e09a562a1bee4c3e6f49a5c9ce81f2ed4aca7b0a3169685833c119db9a35de8c90faf701a8
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

50 lines
3.4 KiB
Text

import { GetOption } from '../GetOption';
import { IsWellFormedCurrencyCode } from '../IsWellFormedCurrencyCode';
import { IsWellFormedUnitIdentifier } from '../IsWellFormedUnitIdentifier';
import { invariant } from '../utils';
/**
* https://tc39.es/ecma402/#sec-setnumberformatunitoptions
*/
export function SetNumberFormatUnitOptions(internalSlots, options) {
if (options === void 0) { options = Object.create(null); }
// 1. Let style be ? GetOption(options, "style", "string", « "decimal", "percent", "currency", "unit" », "decimal").
var style = GetOption(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
// 2. Set internalSlots.[[Style]] to style.
internalSlots.style = style;
// 3. Let currency be ? GetOption(options, "currency", "string", undefined, undefined).
var currency = GetOption(options, 'currency', 'string', undefined, undefined);
// 4. If currency is not undefined, then
// a. If the result of IsWellFormedCurrencyCode(currency) is false, throw a RangeError exception.
invariant(currency === undefined || IsWellFormedCurrencyCode(currency), 'Malformed currency code', RangeError);
// 5. If style is "currency" and currency is undefined, throw a TypeError exception.
invariant(style !== 'currency' || currency !== undefined, 'currency cannot be undefined', TypeError);
// 6. Let currencyDisplay be ? GetOption(options, "currencyDisplay", "string", « "code", "symbol", "narrowSymbol", "name" », "symbol").
var currencyDisplay = GetOption(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
// 7. Let currencySign be ? GetOption(options, "currencySign", "string", « "standard", "accounting" », "standard").
var currencySign = GetOption(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
// 8. Let unit be ? GetOption(options, "unit", "string", undefined, undefined).
var unit = GetOption(options, 'unit', 'string', undefined, undefined);
// 9. If unit is not undefined, then
// a. If the result of IsWellFormedUnitIdentifier(unit) is false, throw a RangeError exception.
invariant(unit === undefined || IsWellFormedUnitIdentifier(unit), 'Invalid unit argument for Intl.NumberFormat()', RangeError);
// 10. If style is "unit" and unit is undefined, throw a TypeError exception.
invariant(style !== 'unit' || unit !== undefined, 'unit cannot be undefined', TypeError);
// 11. Let unitDisplay be ? GetOption(options, "unitDisplay", "string", « "short", "narrow", "long" », "short").
var unitDisplay = GetOption(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
// 12. If style is "currency", then
if (style === 'currency') {
// a. Set internalSlots.[[Currency]] to the result of converting currency to upper case as specified in 6.1.
internalSlots.currency = currency.toUpperCase();
// b. Set internalSlots.[[CurrencyDisplay]] to currencyDisplay.
internalSlots.currencyDisplay = currencyDisplay;
// c. Set internalSlots.[[CurrencySign]] to currencySign.
internalSlots.currencySign = currencySign;
}
// 13. If style is "unit", then
if (style === 'unit') {
// a. Set internalSlots.[[Unit]] to unit.
internalSlots.unit = unit;
// b. Set internalSlots.[[UnitDisplay]] to unitDisplay.
internalSlots.unitDisplay = unitDisplay;
}
}