Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deserialize(serialized) {
var obj = JSON.parse(
LZString.decompressFromUint8Array(
new Uint8Array(serialized)
)
);
var replay = {};
var i = 0;
replay.version = obj[i++];
replay.id = obj[i++];
replay.mapWidth = obj[i++];
replay.mapHeight = obj[i++];
replay.usernames = obj[i++];
replay.stars = obj[i++];
replay.cities = obj[i++];
replay.cityArmies = obj[i++]
replay.generals = obj[i++];
replay.mountains = obj[i++];
export const decompress = str => {
const compressed = str.match(/.{2}/g).map(hexToDecimal);
return LZString.decompressFromUint8Array(compressed);
};
const getProps = () => {
const compressedProps = document.getElementById('react-ssr-script').dataset.props;
const decoded = URLSafeBase64.decode(compressedProps);
const decompressed = LZString.decompressFromUint8Array(decoded);
return JSON.parse(decompressed);
}
decompress: async buffer => lzstring.decompressFromUint8Array(buffer)
},
const getProps = () => {
const compressedProps = document.getElementById('react-ssr-script').dataset.props;
const decoded = URLSafeBase64.decode(compressedProps);
const decompressed = LZString.decompressFromUint8Array(decoded);
return JSON.parse(decompressed);
}