save rosters in localStorage, better mobile support for 10th edition, add tailwind

This commit is contained in:
NilsUeter
2023-10-20 22:11:23 +02:00
parent 4777d84819
commit 2c49e646b4
13 changed files with 4462 additions and 2030 deletions
+31
View File
@@ -0,0 +1,31 @@
function replacer(key, value) {
if (value instanceof Map) {
return {
dataType: "Map",
value: Array.from(value.entries()), // or with spread: value: [...value]
};
} else if (value instanceof Set) {
return ["__isSet", ...value];
} else {
return value;
}
}
function reviver(key, value) {
if (value instanceof Array && value[0] === "__isSet") {
return new Set(value.slice(1));
}
if (typeof value === "object" && value !== null) {
if (value.dataType === "Map") {
return new Map(value.value);
}
}
return value;
}
export const parseJSON = (string) => {
return JSON.parse(string, reviver);
};
export const stringifyJSON = (value) => {
return JSON.stringify(value, replacer);
};