src/third_party/mozjs/extract/js/src/builtin/intl/CommonFunctions.js
/**
 * Returns the Unicode extension value subtags for the requested key subtag.
 *
 * Spec: ECMAScript Internationalization API Specification, 9.2.5.
 */
Returns the Unicode extension value subtags for the requested key subtag.
Spec: ECMAScript Internationalization API Specification, 9.2.5.
Returns the Unicode extension value subtags for the requested key subtag . Spec : ECMAScript Internationalization API Specification 9 . 2 . 5 .
function UnicodeExtensionValue(extension, key) {
    assert(typeof extension === "string", "extension is a string value");
    assert(callFunction(std_String_startsWith, extension, "-u-") &&
           getUnicodeExtensions("und" + extension) === extension,
           "extension is a Unicode extension subtag");
    assert(typeof key === "string", "key is a string value");
    assert(key.length === 2, "key is a Unicode extension key subtag");
    var size = extension.length;
    var searchValue = "-" + key + "-";
    var pos = callFunction(std_String_indexOf, extension, searchValue);
    if (pos !== -1) {
        a.
        var start = pos + 4;
        b.
        var end = start;
        c.
        var k = start;
        while (true) {
            e.i.
            var e = callFunction(std_String_indexOf, extension, "-", k);
            e.ii.
            var len = e === -1 ? size - k : e - k;
            e.iii.
            if (len === 2)
                break;
            e.iv.
            if (e === -1) {
                end = size;
                break;
            }
            e.v.
            end = e;
            k = e + 1;
        }
        f.
        return callFunction(String_substring, extension, start, end);
    }
    searchValue = "-" + key;
    if (callFunction(std_String_endsWith, extension, searchValue))
        return "";
}
function UnicodeExtensionValue ( extension , key ) { assert ( typeof extension === "string" , "extension is a string value" ) ; assert ( callFunction ( std_String_startsWith , extension , "-u-" ) && getUnicodeExtensions ( "und" + extension ) === extension , "extension is a Unicode extension subtag" ) ; assert ( typeof key === "string" , "key is a string value" ) ; assert ( key . length === 2 , "key is a Unicode extension key subtag" ) ; var size = extension . length ; var searchValue = "-" + key + "-" ; var pos = callFunction ( std_String_indexOf , extension , searchValue ) ; if ( pos !== - 1 ) { var start = pos + 4 ; var end = start ; var k = start ; while ( true ) { var e = callFunction ( std_String_indexOf , extension , "-" , k ) ; var len = e === - 1 ? size - k : e - k ; if ( len === 2 ) break ; if ( e === - 1 ) { end = size ; break ; } end = e ; k = e + 1 ; } return callFunction ( String_substring , extension , start , end ) ; } searchValue = "-" + key ; if ( callFunction ( std_String_endsWith , extension , searchValue ) ) return "" ; }
Returns the Unicode extension value subtags for the requested key subtag.
Returns the Unicode extension value subtags for the requested key subtag .
// Step 1. // Step 2. // Step 3. // Step 4. // Step 5. // Step 5.a. // Step 5.b. // Step 5.c. // Steps 5.d-e. // Step 5.e.i. // Step 5.e.ii. // Step 5.e.iii. // Step 5.e.iv. // Step 5.e.v. // Step 5.f. // Step 6. // Steps 7-8. // Step 9 (implicit).