More things for web
This commit is contained in:
1 parent
78b1058276
commit
a1ab487084
8 files changed
+87
-8
No files matched your search
+14
-2
@@ -1,9 +1,21 @@
|
||||
import { Player } from "@/types/player";
|
||||
|
||||
export function parsePlayerData(raw: string): Array<Player> {
|
||||
return [];
|
||||
const tokens: string[] = raw.match(/\{([^}]+)\}/g) || [];
|
||||
const players: Player[] = [];
|
||||
for (const token of tokens) {
|
||||
players.push(JSON.parse(token));
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
export function formatPlayerData(arr: Array<Player>): string {
|
||||
return "";
|
||||
let s = "";
|
||||
for (const player of arr) {
|
||||
if (s.length > 0) {
|
||||
s += ",";
|
||||
}
|
||||
s += JSON.stringify(player);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
Reference in new issue
Block a user