chuvsu-js 3.0.1 → 3.0.2

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,20 @@ 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 its code; trailing qualifiers like "ин" belong to
25
+ // the current group until the next code begins.
26
+ const startsGroup = (token) => /^[A-ZА-ЯЁ]{1,}-\d{1,2}-\d{2,4}[A-ZА-ЯЁa-zа-яё]*$/u.test(token);
27
+ let current = "";
28
+ for (const token of cleaned.split(/\s+/)) {
29
+ if (startsGroup(token)) {
30
+ if (current)
31
+ out.push(current);
32
+ current = token;
33
+ continue;
34
+ }
35
+ current = current ? `${current} ${token}` : token;
26
36
  }
37
+ if (current)
38
+ out.push(current);
27
39
  return out;
28
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chuvsu-js",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
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})\"",