src/third_party/mozjs/extract/js/src/builtin/intl/NumberFormat.js
/**
 * Applies digit options used for number formatting onto the intl object.
 *
 * Spec: ECMAScript Internationalization API Specification, 11.1.1.
 */
Applies digit options used for number formatting onto the intl object.
Spec: ECMAScript Internationalization API Specification, 11.1.1.
Applies digit options used for number formatting onto the intl object . Spec : ECMAScript Internationalization API Specification 11 . 1 . 1 .
function SetNumberFormatDigitOptions(lazyData, options, mnfdDefault, mxfdDefault, notation) {
    assert(IsObject(options), "SetNumberFormatDigitOptions");
    assert(typeof mnfdDefault === "number", "SetNumberFormatDigitOptions");
    assert(typeof mxfdDefault === "number", "SetNumberFormatDigitOptions");
    assert(mnfdDefault <= mxfdDefault, "SetNumberFormatDigitOptions");
    assert(typeof notation === "string", "SetNumberFormatDigitOptions");
    const mnid = GetNumberOption(options, "minimumIntegerDigits", 1, 21, 1);
    let mnfd = options.minimumFractionDigits;
    let mxfd = options.maximumFractionDigits;
    let mnsd = options.minimumSignificantDigits;
    let mxsd = options.maximumSignificantDigits;
    lazyData.minimumIntegerDigits = mnid;
    if (mnsd !== undefined || mxsd !== undefined) {
        a (Omitted).
        b.
        mnsd = DefaultNumberOption(mnsd, 1, 21, 1);
        c.
        mxsd = DefaultNumberOption(mxsd, mnsd, 21, 21);
        d.
        lazyData.minimumSignificantDigits = mnsd;
        e.
        lazyData.maximumSignificantDigits = mxsd;
    }
    else if (mnfd !== undefined || mxfd !== undefined) {
        a (Omitted).
        b.
        mnfd = DefaultNumberOption(mnfd, 0, 20, undefined);
        c.
        mxfd = DefaultNumberOption(mxfd, 0, 20, undefined);
        if (mnfd === undefined) {
            assert(mxfd !== undefined, "mxfd isn't undefined when mnfd is undefined");
            mnfd = std_Math_min(mnfdDefault, mxfd);
        }
        f.
        else if (mxfd === undefined) {
            mxfd = std_Math_max(mxfdDefault, mnfd);
        }
        g.
        else if (mnfd > mxfd) {
            ThrowRangeError(JSMSG_INVALID_DIGITS_VALUE, mxfd);
        }
        h.
        lazyData.minimumFractionDigits = mnfd;
        i.
        lazyData.maximumFractionDigits = mxfd;
    }
    else if (notation === "compact") {
        a (Omitted).
    }
    else {
        a (Omitted).
        b.
        lazyData.minimumFractionDigits = mnfdDefault;
        c.
        lazyData.maximumFractionDigits = mxfdDefault;
    }
}
function SetNumberFormatDigitOptions ( lazyData , options , mnfdDefault , mxfdDefault , notation ) { assert ( IsObject ( options ) , "SetNumberFormatDigitOptions" ) ; assert ( typeof mnfdDefault === "number" , "SetNumberFormatDigitOptions" ) ; assert ( typeof mxfdDefault === "number" , "SetNumberFormatDigitOptions" ) ; assert ( mnfdDefault <= mxfdDefault , "SetNumberFormatDigitOptions" ) ; assert ( typeof notation === "string" , "SetNumberFormatDigitOptions" ) ; const mnid = GetNumberOption ( options , "minimumIntegerDigits" , 1 , 21 , 1 ) ; let mnfd = options . minimumFractionDigits ; let mxfd = options . maximumFractionDigits ; let mnsd = options . minimumSignificantDigits ; let mxsd = options . maximumSignificantDigits ; lazyData . minimumIntegerDigits = mnid ; if ( mnsd !== undefined || mxsd !== undefined ) { mnsd = DefaultNumberOption ( mnsd , 1 , 21 , 1 ) ; mxsd = DefaultNumberOption ( mxsd , mnsd , 21 , 21 ) ; lazyData . minimumSignificantDigits = mnsd ; lazyData . maximumSignificantDigits = mxsd ; } else if ( mnfd !== undefined || mxfd !== undefined ) { mnfd = DefaultNumberOption ( mnfd , 0 , 20 , undefined ) ; mxfd = DefaultNumberOption ( mxfd , 0 , 20 , undefined ) ; if ( mnfd === undefined ) { assert ( mxfd !== undefined , "mxfd isn't undefined when mnfd is undefined" ) ; mnfd = std_Math_min ( mnfdDefault , mxfd ) ; } else if ( mxfd === undefined ) { mxfd = std_Math_max ( mxfdDefault , mnfd ) ; } else if ( mnfd > mxfd ) { ThrowRangeError ( JSMSG_INVALID_DIGITS_VALUE , mxfd ) ; } lazyData . minimumFractionDigits = mnfd ; lazyData . maximumFractionDigits = mxfd ; } else if ( notation === "compact" ) { } else { lazyData . minimumFractionDigits = mnfdDefault ; lazyData . maximumFractionDigits = mxfdDefault ; } }
Applies digit options used for number formatting onto the intl object.
Applies digit options used for number formatting onto the intl object .
// We skip step 1 because we set the properties on a lazyData object. // Steps 2-4. // Steps 5-9. // Step 10. // Step 11. // Step 11.a (Omitted). // Step 11.b. // Step 11.c. // Step 11.d. // Step 11.e. // Step 12. // Step 12.a (Omitted). // Step 12.b. // Step 12.c. // Steps 12.d-e. // Inlined DefaultNumberOption, only the fallback case applies here. // Step 12.f. // Inlined DefaultNumberOption, only the fallback case applies here. // Step 12.g. // Step 12.h. // Step 12.i. // Step 13. // Step 13.a (Omitted). // Step 14. // Step 14.a (Omitted). // Step 14.b. // Step 14.c.