src/third_party/mozjs/extract/js/src/builtin/String.js
/**
 * Compare this String against that String, using the locale and collation
 * options provided.
 *
 * Spec: ECMAScript Internationalization API Specification, 13.1.1.
 */
Compare this String against that String, using the locale and collation
options provided.

ECMAScript Internationalization API Specification, 13.1.1.
Compare this String against that String using the locale and collation options provided . ECMAScript Internationalization API Specification 13 . 1 . 1 .
function String_localeCompare(that) {
    if (this === undefined || this === null)
        ThrowIncompatibleMethod("localeCompare", this);
    var S = ToString(this);
    var That = ToString(that);
    var locales = arguments.length > 1 ? arguments[1] : undefined;
    var options = arguments.length > 2 ? arguments[2] : undefined;
    var collator;
    if (locales === undefined && options === undefined) {
        if (!intl_IsRuntimeDefaultLocale(collatorCache.runtimeDefaultLocale)) {
            collatorCache.collator = intl_Collator(locales, options);
            collatorCache.runtimeDefaultLocale = intl_RuntimeDefaultLocale();
        }
        collator = collatorCache.collator;
    } else {
        collator = intl_Collator(locales, options);
    }
    return intl_CompareStrings(collator, S, That);
}
function String_localeCompare ( that ) { if ( this === undefined || this === null ) ThrowIncompatibleMethod ( "localeCompare" , this ) ; var S = ToString ( this ) ; var That = ToString ( that ) ; var locales = arguments . length > 1 ? arguments [ 1 ] : undefined ; var options = arguments . length > 2 ? arguments [ 2 ] : undefined ; var collator ; if ( locales === undefined && options === undefined ) { if ( ! intl_IsRuntimeDefaultLocale ( collatorCache . runtimeDefaultLocale ) ) { collatorCache . collator = intl_Collator ( locales , options ) ; collatorCache . runtimeDefaultLocale = intl_RuntimeDefaultLocale ( ) ; } collator = collatorCache . collator ; } else { collator = intl_Collator ( locales , options ) ; } return intl_CompareStrings ( collator , S , That ) ; }
Compare this String against that String, using the locale and collation
 options provided.
Compare this String against that String using the locale and collation options provided .
// Step 1. // Steps 2-3. // Steps 4-5. // Step 6. // This cache only optimizes for the old ES5 localeCompare without // locales and options. // Step 7.