12345678910111213141516171819 |
- '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');
- 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');
- }
-
- return $fromCharCode(lead) + $fromCharCode(trail);
- };
|