in packages/fbjs/src/unicode/UnicodeUtils.js [51:67]
function isSurrogatePair(str, index) {
invariant(
0 <= index && index < str.length,
'isSurrogatePair: Invalid index %s for string length %s.',
index,
str.length
);
if (index + 1 === str.length) {
return false;
}
const first = str.charCodeAt(index);
const second = str.charCodeAt(index + 1);
return (
SURROGATE_HIGH_START <= first && first <= SURROGATE_HIGH_END &&
SURROGATE_LOW_START <= second && second <= SURROGATE_LOW_END
);
}