Urara-Blog/node_modules/.pnpm-store/v3/files/c1/3e55e8f2387c7e2198da5c65c627418cd781081aa3388fde728cefb2ea239b965955e6d324aaf1eae10a00f7d0288fa673b711953f65bc9ac08b2a10f160f3
2022-08-14 01:14:53 +08:00

19 lines
776 B
Text

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
// https://262.ecma-international.org/11.0/#sec-utf16decodesurrogatepair
module.exports = function UTF16DecodeSurrogatePair(lead, trail) {
if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) {
throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code');
}
// var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
return $fromCharCode(lead) + $fromCharCode(trail);
};