1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/lib/string.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,24 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 + 1.9 +if (typeof isHighSurrogate === 'undefined') { 1.10 + var isHighSurrogate = function isHighSurrogate(s) { 1.11 + var c = s.charCodeAt(0); 1.12 + return c >= 0xD800 && c <= 0xDBFF; 1.13 + } 1.14 +} 1.15 + 1.16 +if (typeof isLowSurrogate === 'undefined') { 1.17 + var isLowSurrogate = function isLowSurrogate(s) { 1.18 + var c = s.charCodeAt(0); 1.19 + return c >= 0xDC00 && c <= 0xDFFF; 1.20 + } 1.21 +} 1.22 + 1.23 +if (typeof isSurrogatePair === 'undefined') { 1.24 + var isSurrogatePair = function isSurrogatePair(s) { 1.25 + return s.length == 2 && isHighSurrogate(s[0]) && isLowSurrogate(s[1]); 1.26 + } 1.27 +}