src/third_party/mozjs/extract/js/src/builtin/intl/NumberFormat.js
/**
 * Returns the resolved options for a NumberFormat object.
 *
 * Spec: ECMAScript Internationalization API Specification, 11.4.5.
 */
Returns the resolved options for a NumberFormat object.
Spec: ECMAScript Internationalization API Specification, 11.4.5.
Returns the resolved options for a NumberFormat object . Spec : ECMAScript Internationalization API Specification 11 . 4 . 5 .
function Intl_NumberFormat_resolvedOptions() {
    var thisArg = UnwrapNumberFormat(this);
    var nf = thisArg;
    if (!IsObject(nf) || (nf = intl_GuardToNumberFormat(nf)) === null) {
        return callFunction(intl_CallNumberFormatMethodIfWrapped, thisArg,
                            "Intl_NumberFormat_resolvedOptions");
    }
    var internals = getNumberFormatInternals(nf);
    var result = {
        locale: internals.locale,
        numberingSystem: internals.numberingSystem,
        style: internals.style,
    };
    assert(hasOwn("currency", internals) === (internals.style === "currency"),
           "currency is present iff style is 'currency'");
    assert(hasOwn("currencyDisplay", internals) === (internals.style === "currency"),
           "currencyDisplay is present iff style is 'currency'");
    assert(hasOwn("currencySign", internals) === (internals.style === "currency"),
           "currencySign is present iff style is 'currency'");
    if (hasOwn("currency", internals)) {
        DefineDataProperty(result, "currency", internals.currency);
        DefineDataProperty(result, "currencyDisplay", internals.currencyDisplay);
        DefineDataProperty(result, "currencySign", internals.currencySign);
    }
    assert(hasOwn("unit", internals) === (internals.style === "unit"),
           "unit is present iff style is 'unit'");
    assert(hasOwn("unitDisplay", internals) === (internals.style === "unit"),
           "unitDisplay is present iff style is 'unit'");
    if (hasOwn("unit", internals)) {
        DefineDataProperty(result, "unit", internals.unit);
        DefineDataProperty(result, "unitDisplay", internals.unitDisplay);
    }
    DefineDataProperty(result, "minimumIntegerDigits", internals.minimumIntegerDigits);
    assert(hasOwn("minimumFractionDigits", internals) ===
           hasOwn("maximumFractionDigits", internals),
           "minimumFractionDigits is present iff maximumFractionDigits is present");
    if (hasOwn("minimumFractionDigits", internals)) {
        DefineDataProperty(result, "minimumFractionDigits", internals.minimumFractionDigits);
        DefineDataProperty(result, "maximumFractionDigits", internals.maximumFractionDigits);
    }
    assert(hasOwn("minimumSignificantDigits", internals) ===
           hasOwn("maximumSignificantDigits", internals),
           "minimumSignificantDigits is present iff maximumSignificantDigits is present");
    if (hasOwn("minimumSignificantDigits", internals)) {
        DefineDataProperty(result, "minimumSignificantDigits",
                           internals.minimumSignificantDigits);
        DefineDataProperty(result, "maximumSignificantDigits",
                           internals.maximumSignificantDigits);
    }
    DefineDataProperty(result, "useGrouping", internals.useGrouping);
    var notation = internals.notation;
    DefineDataProperty(result, "notation", notation);
    if (notation === "compact")
        DefineDataProperty(result, "compactDisplay", internals.compactDisplay);
    DefineDataProperty(result, "signDisplay", internals.signDisplay);
    return result;
}
function Intl_NumberFormat_resolvedOptions ( ) { var thisArg = UnwrapNumberFormat ( this ) ; var nf = thisArg ; if ( ! IsObject ( nf ) || ( nf = intl_GuardToNumberFormat ( nf ) ) === null ) { return callFunction ( intl_CallNumberFormatMethodIfWrapped , thisArg , "Intl_NumberFormat_resolvedOptions" ) ; } var internals = getNumberFormatInternals ( nf ) ; var result = { locale : internals . locale , numberingSystem : internals . numberingSystem , style : internals . style , } ; assert ( hasOwn ( "currency" , internals ) === ( internals . style === "currency" ) , "currency is present iff style is 'currency'" ) ; assert ( hasOwn ( "currencyDisplay" , internals ) === ( internals . style === "currency" ) , "currencyDisplay is present iff style is 'currency'" ) ; assert ( hasOwn ( "currencySign" , internals ) === ( internals . style === "currency" ) , "currencySign is present iff style is 'currency'" ) ; if ( hasOwn ( "currency" , internals ) ) { DefineDataProperty ( result , "currency" , internals . currency ) ; DefineDataProperty ( result , "currencyDisplay" , internals . currencyDisplay ) ; DefineDataProperty ( result , "currencySign" , internals . currencySign ) ; } assert ( hasOwn ( "unit" , internals ) === ( internals . style === "unit" ) , "unit is present iff style is 'unit'" ) ; assert ( hasOwn ( "unitDisplay" , internals ) === ( internals . style === "unit" ) , "unitDisplay is present iff style is 'unit'" ) ; if ( hasOwn ( "unit" , internals ) ) { DefineDataProperty ( result , "unit" , internals . unit ) ; DefineDataProperty ( result , "unitDisplay" , internals . unitDisplay ) ; } DefineDataProperty ( result , "minimumIntegerDigits" , internals . minimumIntegerDigits ) ; assert ( hasOwn ( "minimumFractionDigits" , internals ) === hasOwn ( "maximumFractionDigits" , internals ) , "minimumFractionDigits is present iff maximumFractionDigits is present" ) ; if ( hasOwn ( "minimumFractionDigits" , internals ) ) { DefineDataProperty ( result , "minimumFractionDigits" , internals . minimumFractionDigits ) ; DefineDataProperty ( result , "maximumFractionDigits" , internals . maximumFractionDigits ) ; } assert ( hasOwn ( "minimumSignificantDigits" , internals ) === hasOwn ( "maximumSignificantDigits" , internals ) , "minimumSignificantDigits is present iff maximumSignificantDigits is present" ) ; if ( hasOwn ( "minimumSignificantDigits" , internals ) ) { DefineDataProperty ( result , "minimumSignificantDigits" , internals . minimumSignificantDigits ) ; DefineDataProperty ( result , "maximumSignificantDigits" , internals . maximumSignificantDigits ) ; } DefineDataProperty ( result , "useGrouping" , internals . useGrouping ) ; var notation = internals . notation ; DefineDataProperty ( result , "notation" , notation ) ; if ( notation === "compact" ) DefineDataProperty ( result , "compactDisplay" , internals . compactDisplay ) ; DefineDataProperty ( result , "signDisplay" , internals . signDisplay ) ; return result ; }
Returns the resolved options for a NumberFormat object.
Returns the resolved options for a NumberFormat object .
// Steps 1-3. // Steps 4-5. // currency, currencyDisplay, and currencySign are only present for currency // formatters. // unit and unitDisplay are only present for unit formatters. // Min/Max fraction digits are either both present or not present at all. // Min/Max significant digits are either both present or not present at all. // Step 6.