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

37 lines
950 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
*/
'use strict';
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;
};
module.exports = 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);
};