src/third_party/mozjs/extract/js/src/builtin/intl/ListFormat.js
/**
 * Intl.ListFormat ( [ locales [ , options ] ] )
 *
 * Initializes an object as a ListFormat.
 *
 * This method is complicated a moderate bit by its implementing initialization
 * as a *lazy* concept.  Everything that must happen now, does -- but we defer
 * all the work we can until the object is actually used as a ListFormat.
 * This later work occurs in |resolveListFormatInternals|; steps not noted
 * here occur there.
 */
Intl.ListFormat ( [ locales [ , options ] ] )
Initializes an object as a ListFormat.

This method is complicated a moderate bit by its implementing initialization
as a *lazy* concept.  Everything that must happen now, does -- but we defer
all the work we can until the object is actually used as a ListFormat.
This later work occurs in |resolveListFormatInternals|; steps not noted
here occur there.
Intl . ListFormat ( [ locales [ options ] ] ) Initializes an object as a ListFormat . This method is complicated a moderate bit by its implementing initialization as a * lazy * concept . Everything that must happen now does -- but we defer all the work we can until the object is actually used as a ListFormat . This later work occurs in |resolveListFormatInternals| ; steps not noted here occur there .
function InitializeListFormat(listFormat, locales, options) {
    assert(IsObject(listFormat), "InitializeListFormat called with non-object");
    assert(intl_GuardToListFormat(listFormat) !== null,
           "InitializeListFormat called with non-ListFormat");
       {
         requestedLocales: List of locales,
         type: "conjunction" / "disjunction" / "unit",
         style: "long" / "short" / "narrow",
         opt:  opt object computed in InitializeListFormat
           {
             localeMatcher: "lookup" / "best fit",
           }
       }
     Note that lazy data is only installed as a final step of initialization,
     so every ListFormat lazy data object has *all* these properties, never a
     subset of them.
    var lazyListFormatData = std_Object_create(null);
     Step 3.
    var requestedLocales = CanonicalizeLocaleList(locales);
    lazyListFormatData.requestedLocales = requestedLocales;
     Steps 4-5.
    if (options === undefined)
        options = std_Object_create(null);
    else if (!IsObject(options))
        ThrowTypeError(JSMSG_OBJECT_REQUIRED, options === null ? "null" : typeof options);
     Step 6.
    var opt = new_Record();
    lazyListFormatData.opt = opt;
     Steps 7-8.
    let matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
    opt.localeMatcher = matcher;
     Compute formatting options.
     Steps 12-13.
    var type = GetOption(options, "type", "string", ["conjunction", "disjunction", "unit"],
                         "conjunction");
    lazyListFormatData.type = type;
     Steps 14-15.
    var style = GetOption(options, "style", "string", ["long", "short", "narrow"], "long");
    lazyListFormatData.style = style;
     We've done everything that must be done now: mark the lazy data as fully
     computed and install it.
    initializeIntlObject(listFormat, "ListFormat", lazyListFormatData);
}
function InitializeListFormat ( listFormat , locales , options ) { assert ( IsObject ( listFormat ) , "InitializeListFormat called with non-object" ) ; assert ( intl_GuardToListFormat ( listFormat ) !== null , "InitializeListFormat called with non-ListFormat" ) ; var lazyListFormatData = std_Object_create ( null ) ; var requestedLocales = CanonicalizeLocaleList ( locales ) ; lazyListFormatData . requestedLocales = requestedLocales ; if ( options === undefined ) options = std_Object_create ( null ) ; else if ( ! IsObject ( options ) ) ThrowTypeError ( JSMSG_OBJECT_REQUIRED , options === null ? "null" : typeof options ) ; var opt = new_Record ( ) ; lazyListFormatData . opt = opt ; let matcher = GetOption ( options , "localeMatcher" , "string" , [ "lookup" , "best fit" ] , "best fit" ) ; opt . localeMatcher = matcher ; var type = GetOption ( options , "type" , "string" , [ "conjunction" , "disjunction" , "unit" ] , "conjunction" ) ; lazyListFormatData . type = type ; var style = GetOption ( options , "style" , "string" , [ "long" , "short" , "narrow" ] , "long" ) ; lazyListFormatData . style = style ; initializeIntlObject ( listFormat , "ListFormat" , lazyListFormatData ) ; }
Intl.ListFormat ( [ locales [ , options ] ] )
 Initializes an object as a ListFormat.
Intl . ListFormat ( [ locales [ options ] ] ) Initializes an object as a ListFormat .
// Lazy ListFormat data has the following structure: // //   { //     requestedLocales: List of locales, //     type: "conjunction" / "disjunction" / "unit", //     style: "long" / "short" / "narrow", // //     opt: // opt object computed in InitializeListFormat //       { //         localeMatcher: "lookup" / "best fit", //       } //   } // // Note that lazy data is only installed as a final step of initialization, // so every ListFormat lazy data object has *all* these properties, never a // subset of them. // Step 3. // Steps 4-5. // Step 6. // Steps 7-8. // Compute formatting options. // Steps 12-13. // Steps 14-15. // We've done everything that must be done now: mark the lazy data as fully // computed and install it.