mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add LevelLinter (static checks) and LevelChecker (execution checks) shared by tests and the future author editor
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export function ucs2length(s) {
|
||||
let result = 0;
|
||||
let length = s.length;
|
||||
let index = 0;
|
||||
let charCode;
|
||||
while (index < length) {
|
||||
result++;
|
||||
charCode = s.charCodeAt(index++);
|
||||
if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {
|
||||
charCode = s.charCodeAt(index);
|
||||
if ((charCode & 0xfc00) == 0xdc00) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user