steamutils 1.5.14 → 1.5.15

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",
package/utils.js CHANGED
@@ -1217,3 +1217,18 @@ export function formatFriendState(data) {
1217
1217
  rich_presence,
1218
1218
  };
1219
1219
  }
1220
+
1221
+ export function getGameDetailScore(scoreString) {
1222
+ if (typeof scoreString !== "string") {
1223
+ return null;
1224
+ }
1225
+ const regex = /\[\s*(\d+)\s*:\s*(\d+)\s*\]/;
1226
+ const matches = scoreString.match(regex);
1227
+ if (matches) {
1228
+ // The first capturing group (matches[1]) is the first score, the second (matches[2]) is the second score
1229
+ const score1 = matches[1];
1230
+ const score2 = matches[2];
1231
+ return [score1, score2].map(Number);
1232
+ }
1233
+ // console.log("No match found", scoreString);
1234
+ }