chuvsu-js 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,8 +21,21 @@ export function parseGroupsString(raw) {
21
21
  if (!cleaned)
22
22
  return [];
23
23
  const out = [];
24
- for (const m of cleaned.matchAll(/(\S+)(?:\s+\(([^)]+)\))?/g)) {
25
- out.push(m[2] ? `${m[1]} (${m[2]})` : m[1]);
24
+ // A new group starts from a code-like token. Optional qualifiers like "ин"
25
+ // may be attached either directly ("М-30-25ин") or as a separate tail
26
+ // ("УП-51-23 ин"), so they stay with the current group until the next code.
27
+ const startsGroup = (token) => /^[A-ZА-ЯЁ]{1,}(?:-[A-ZА-ЯЁa-zа-яё0-9]+)+$/u.test(token);
28
+ let current = "";
29
+ for (const token of cleaned.split(/\s+/)) {
30
+ if (startsGroup(token)) {
31
+ if (current)
32
+ out.push(current);
33
+ current = token;
34
+ continue;
35
+ }
36
+ current = current ? `${current} ${token}` : token;
26
37
  }
38
+ if (current)
39
+ out.push(current);
27
40
  return out;
28
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chuvsu-js",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Node.js library for ChuvSU student portal (lk.chuvsu.ru) and schedule (tt.chuvsu.ru)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,11 +34,11 @@
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
36
  "linkedom": "^0.18.12",
37
- "undici": "^7.20.0"
37
+ "undici": "^8.1.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^25.2.1",
41
- "typescript": "^5.9.3"
40
+ "@types/node": "^25.6.0",
41
+ "typescript": "^6.0.3"
42
42
  },
43
43
  "scripts": {
44
44
  "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",