steamutils 1.5.14 → 1.5.15
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/utils.js +15 -0
package/package.json
CHANGED
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
|
+
}
|