Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function serialiseState(stateText) {
var ctx = GoldenLayout.minifyConfig({content: stateText.content});
ctx.version = 4;
var uncompressed = risonify(ctx);
var compressed = risonify({z: lzstring.compressToBase64(uncompressed)});
var MinimalSavings = 0.20; // at least this ratio smaller
if (compressed.length < uncompressed.length * (1.0 - MinimalSavings)) {
return compressed;
} else {
return uncompressed;
}
}