mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
11 lines
370 B
TypeScript
11 lines
370 B
TypeScript
import lzs from 'lz-string'
|
|
|
|
// https://github.com/microsoft/TypeScript-Website/tree/v2/packages/playground
|
|
export function toPlaygroundUrl(
|
|
code: string,
|
|
config: Object = {},
|
|
site = 'https://www.staging-typescript.org/play',
|
|
) {
|
|
return `${site}?${Object.entries(config).map(([k, v]) => `${k}=${v}`).join('&')}#code/${lzs.compressToEncodedURIComponent(code)}`
|
|
}
|