Files
NapCatQQ/.pnpm-store/v3/files/8f/2d0cfb9b07ce6ede56f4da9d71f1e25660020ad5294c355f060543dc53d68ca7c8c617f1b7f797babcd40de6c2ef75721335e498f4cdcea45b26edcab52dcc
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

35 lines
932 B
Plaintext

/*!
* String.prototype.codePointAt v0.2.0 | MIT (c) Mathias Bynens (@mathias)
* http://mths.be/codepointat
*
* code-point | MIT (c) Shinnosuke Watanabe
* https://github.com/shinnn/code-point.js
*/
var getCodePoint = typeof String.prototype.codePointAt === 'function' ? function getCodePoint(str) {
return str.codePointAt(0);
} : function getCodePoint(str) {
var first = str.charCodeAt(0);
if (first >= 0xD800 && first <= 0xDBFF && str.length > 1) {
var second = str.charCodeAt(1);
if (second >= 0xDC00 && second <= 0xDFFF) {
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
}
}
return first;
};
export default function codePoint(str) {
if (typeof str !== 'string') {
throw new TypeError(String(str) + ' is not a string. Argument must be a string.');
}
if (str.length === 0) {
throw new Error('Argument must be a non-empty string.');
}
return getCodePoint(str);
}