michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: if (typeof isHighSurrogate === 'undefined') { michael@0: var isHighSurrogate = function isHighSurrogate(s) { michael@0: var c = s.charCodeAt(0); michael@0: return c >= 0xD800 && c <= 0xDBFF; michael@0: } michael@0: } michael@0: michael@0: if (typeof isLowSurrogate === 'undefined') { michael@0: var isLowSurrogate = function isLowSurrogate(s) { michael@0: var c = s.charCodeAt(0); michael@0: return c >= 0xDC00 && c <= 0xDFFF; michael@0: } michael@0: } michael@0: michael@0: if (typeof isSurrogatePair === 'undefined') { michael@0: var isSurrogatePair = function isSurrogatePair(s) { michael@0: return s.length == 2 && isHighSurrogate(s[0]) && isLowSurrogate(s[1]); michael@0: } michael@0: }