From Gatsby docs
CodeSandbox uses the same URL compression schema used by the Babel REPL to embed the local code example in a URL.
This is than passed to the (awesome) define api to generate a sandbox on the fly.
From Gatsby docs
CodeSandbox uses the same URL compression schema used by the Babel REPL to embed the local code example in a URL.
This is than passed to the (awesome) define api to generate a sandbox on the fly.
const compress = (string: string) => | |
LZString.compressToBase64(string) | |
.replace(/\+/g, "-") // Convert '+' to '-' | |
.replace(/\//g, "_") // Convert '/' to '_' | |
.replace(/=+$/, ""); // Remove ending '=' | |
const decompress = (string: string) => | |
LZString.decompressFromBase64( | |
string | |
.replace(/-/g, "+") // Convert '-' to '+' | |
.replace(/_/g, "/") // Convert '_' to '/' | |
); |